aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorSean Dague2007-10-19 20:28:18 +0000
committerSean Dague2007-10-19 20:28:18 +0000
commitd4bb430f78d9a70137957c8fe42de8fa620597ef (patch)
tree49612ce0a47acaedfa826d33edbe200c4c2d8b3c /OpenSim
parentchanges to pass nini config object to the modules that get (diff)
downloadopensim-SC-d4bb430f78d9a70137957c8fe42de8fa620597ef.zip
opensim-SC-d4bb430f78d9a70137957c8fe42de8fa620597ef.tar.gz
opensim-SC-d4bb430f78d9a70137957c8fe42de8fa620597ef.tar.bz2
opensim-SC-d4bb430f78d9a70137957c8fe42de8fa620597ef.tar.xz
get rid of all the ^M line endings
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Framework/Communications/Cache/AssetServer.cs312
-rw-r--r--OpenSim/Framework/Communications/Cache/AssetServerBase.cs374
-rw-r--r--OpenSim/Framework/Communications/Cache/SQLAssetServer.cs248
-rw-r--r--OpenSim/Framework/Communications/LoginService.cs630
-rw-r--r--OpenSim/Framework/Data.MySQL/MySQLAssetData.cs318
-rw-r--r--OpenSim/Framework/General/Configuration/AssetConfig.cs166
-rw-r--r--OpenSim/Framework/General/Interfaces/IPlugin.cs114
-rw-r--r--OpenSim/Grid/ScriptEngine/Common/Properties/AssemblyInfo.cs4
-rw-r--r--OpenSim/Grid/ScriptServer/ScriptServer/Region/RegionBase.cs228
-rw-r--r--OpenSim/Grid/UserServer/UserLoginService.cs2
-rw-r--r--OpenSim/Region/Environment/Modules/AssetDownloadModule.cs144
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.Inventory.cs952
-rw-r--r--OpenSim/Region/Environment/Types/BasicQuadTreeNode.cs516
-rw-r--r--OpenSim/Region/Environment/Types/UpdateQueue.cs158
-rw-r--r--OpenSim/Tests/Inventory/Properties/AssemblyInfo.cs70
-rw-r--r--OpenSim/Tests/Inventory/TestInventory.cs2016
16 files changed, 3126 insertions, 3126 deletions
diff --git a/OpenSim/Framework/Communications/Cache/AssetServer.cs b/OpenSim/Framework/Communications/Cache/AssetServer.cs
index b17f65a..22bdc5c 100644
--- a/OpenSim/Framework/Communications/Cache/AssetServer.cs
+++ b/OpenSim/Framework/Communications/Cache/AssetServer.cs
@@ -1,157 +1,157 @@
1/* 1/*
2* Copyright (c) Contributors, http://opensimulator.org/ 2* Copyright (c) Contributors, http://opensimulator.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.IO; 30using System.IO;
31using System.Threading; 31using System.Threading;
32using Db4objects.Db4o; 32using Db4objects.Db4o;
33using Db4objects.Db4o.Query; 33using Db4objects.Db4o.Query;
34using libsecondlife; 34using libsecondlife;
35using Nini.Config; 35using Nini.Config;
36using OpenSim.Framework.Communications.Cache; 36using OpenSim.Framework.Communications.Cache;
37using OpenSim.Framework.Console; 37using OpenSim.Framework.Console;
38using OpenSim.Framework.Interfaces; 38using OpenSim.Framework.Interfaces;
39using OpenSim.Framework.Types; 39using OpenSim.Framework.Types;
40using OpenSim.Framework.Utilities; 40using OpenSim.Framework.Utilities;
41 41
42namespace OpenSim.Framework.Communications.Cache 42namespace OpenSim.Framework.Communications.Cache
43{ 43{
44 public class LocalAssetServer : AssetServerBase 44 public class LocalAssetServer : AssetServerBase
45 { 45 {
46 private IObjectContainer db; 46 private IObjectContainer db;
47 47
48 public LocalAssetServer() 48 public LocalAssetServer()
49 { 49 {
50 bool yapfile; 50 bool yapfile;
51 yapfile = File.Exists(Path.Combine(Util.dataDir(), "regionassets.yap")); 51 yapfile = File.Exists(Path.Combine(Util.dataDir(), "regionassets.yap"));
52 52
53 db = Db4oFactory.OpenFile(Path.Combine(Util.dataDir(), "regionassets.yap")); 53 db = Db4oFactory.OpenFile(Path.Combine(Util.dataDir(), "regionassets.yap"));
54 MainLog.Instance.Verbose("Db4 Asset database creation"); 54 MainLog.Instance.Verbose("Db4 Asset database creation");
55 55
56 if (!yapfile) 56 if (!yapfile)
57 { 57 {
58 SetUpAssetDatabase(); 58 SetUpAssetDatabase();
59 } 59 }
60 } 60 }
61 61
62 public void CreateAndCommitAsset(AssetBase asset) 62 public void CreateAndCommitAsset(AssetBase asset)
63 { 63 {
64 AssetStorage store = new AssetStorage(); 64 AssetStorage store = new AssetStorage();
65 store.Data = asset.Data; 65 store.Data = asset.Data;
66 store.Name = asset.Name; 66 store.Name = asset.Name;
67 store.UUID = asset.FullID; 67 store.UUID = asset.FullID;
68 db.Set(store); 68 db.Set(store);
69 db.Commit(); 69 db.Commit();
70 } 70 }
71 71
72 override public void Close() 72 override public void Close()
73 { 73 {
74 base.Close(); 74 base.Close();
75 75
76 if (db != null) 76 if (db != null)
77 { 77 {
78 MainLog.Instance.Verbose("Closing local asset server database"); 78 MainLog.Instance.Verbose("Closing local asset server database");
79 db.Close(); 79 db.Close();
80 } 80 }
81 } 81 }
82 82
83 override protected void RunRequests() 83 override protected void RunRequests()
84 { 84 {
85 while (true) 85 while (true)
86 { 86 {
87 byte[] idata = null; 87 byte[] idata = null;
88 bool found = false; 88 bool found = false;
89 AssetStorage foundAsset = null; 89 AssetStorage foundAsset = null;
90 ARequest req = this._assetRequests.Dequeue(); 90 ARequest req = this._assetRequests.Dequeue();
91 IObjectSet result = db.Query(new AssetUUIDQuery(req.AssetID)); 91 IObjectSet result = db.Query(new AssetUUIDQuery(req.AssetID));
92 if (result.Count > 0) 92 if (result.Count > 0)
93 { 93 {
94 foundAsset = (AssetStorage)result.Next(); 94 foundAsset = (AssetStorage)result.Next();
95 found = true; 95 found = true;
96 } 96 }
97 97
98 AssetBase asset = new AssetBase(); 98 AssetBase asset = new AssetBase();
99 if (found) 99 if (found)
100 { 100 {
101 asset.FullID = foundAsset.UUID; 101 asset.FullID = foundAsset.UUID;
102 asset.Type = foundAsset.Type; 102 asset.Type = foundAsset.Type;
103 asset.InvType = foundAsset.Type; 103 asset.InvType = foundAsset.Type;
104 asset.Name = foundAsset.Name; 104 asset.Name = foundAsset.Name;
105 idata = foundAsset.Data; 105 idata = foundAsset.Data;
106 asset.Data = idata; 106 asset.Data = idata;
107 _receiver.AssetReceived(asset, req.IsTexture); 107 _receiver.AssetReceived(asset, req.IsTexture);
108 } 108 }
109 else 109 else
110 { 110 {
111 //asset.FullID = ; 111 //asset.FullID = ;
112 _receiver.AssetNotFound(req.AssetID); 112 _receiver.AssetNotFound(req.AssetID);
113 } 113 }
114 114
115 } 115 }
116 116
117 } 117 }
118 118
119 override protected void StoreAsset(AssetBase asset) 119 override protected void StoreAsset(AssetBase asset)
120 { 120 {
121 AssetStorage store = new AssetStorage(); 121 AssetStorage store = new AssetStorage();
122 store.Data = asset.Data; 122 store.Data = asset.Data;
123 store.Name = asset.Name; 123 store.Name = asset.Name;
124 store.UUID = asset.FullID; 124 store.UUID = asset.FullID;
125 db.Set(store); 125 db.Set(store);
126 126
127 CommitAssets(); 127 CommitAssets();
128 } 128 }
129 129
130 protected override void CommitAssets() 130 protected override void CommitAssets()
131 { 131 {
132 db.Commit(); 132 db.Commit();
133 } 133 }
134 134
135 protected virtual void SetUpAssetDatabase() 135 protected virtual void SetUpAssetDatabase()
136 { 136 {
137 MainLog.Instance.Verbose("LOCAL ASSET SERVER", "Setting up asset database"); 137 MainLog.Instance.Verbose("LOCAL ASSET SERVER", "Setting up asset database");
138 138
139 ForEachDefaultAsset(StoreAsset); 139 ForEachDefaultAsset(StoreAsset);
140 ForEachXmlAsset(StoreAsset); 140 ForEachXmlAsset(StoreAsset);
141 } 141 }
142 } 142 }
143 143
144 public class AssetUUIDQuery : Predicate 144 public class AssetUUIDQuery : Predicate
145 { 145 {
146 private LLUUID _findID; 146 private LLUUID _findID;
147 147
148 public AssetUUIDQuery(LLUUID find) 148 public AssetUUIDQuery(LLUUID find)
149 { 149 {
150 _findID = find; 150 _findID = find;
151 } 151 }
152 public bool Match(AssetStorage asset) 152 public bool Match(AssetStorage asset)
153 { 153 {
154 return (asset.UUID == _findID); 154 return (asset.UUID == _findID);
155 } 155 }
156 } 156 }
157} \ No newline at end of file 157} \ No newline at end of file
diff --git a/OpenSim/Framework/Communications/Cache/AssetServerBase.cs b/OpenSim/Framework/Communications/Cache/AssetServerBase.cs
index 858019f..08d5b87 100644
--- a/OpenSim/Framework/Communications/Cache/AssetServerBase.cs
+++ b/OpenSim/Framework/Communications/Cache/AssetServerBase.cs
@@ -1,188 +1,188 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.IO; 3using System.IO;
4using System.Threading; 4using System.Threading;
5using libsecondlife; 5using libsecondlife;
6using Nini.Config; 6using Nini.Config;
7using OpenSim.Framework.Console; 7using OpenSim.Framework.Console;
8using OpenSim.Framework.Interfaces; 8using OpenSim.Framework.Interfaces;
9using OpenSim.Framework.Types; 9using OpenSim.Framework.Types;
10using OpenSim.Framework.Utilities; 10using OpenSim.Framework.Utilities;
11 11
12namespace OpenSim.Framework.Communications.Cache 12namespace OpenSim.Framework.Communications.Cache
13{ 13{
14 public abstract class AssetServerBase : IAssetServer 14 public abstract class AssetServerBase : IAssetServer
15 { 15 {
16 protected IAssetReceiver _receiver; 16 protected IAssetReceiver _receiver;
17 protected BlockingQueue<ARequest> _assetRequests; 17 protected BlockingQueue<ARequest> _assetRequests;
18 protected Thread _localAssetServerThread; 18 protected Thread _localAssetServerThread;
19 protected IAssetProvider m_assetProviderPlugin; 19 protected IAssetProvider m_assetProviderPlugin;
20 protected object syncLock = new object(); 20 protected object syncLock = new object();
21 21
22 protected abstract void StoreAsset(AssetBase asset); 22 protected abstract void StoreAsset(AssetBase asset);
23 protected abstract void CommitAssets(); 23 protected abstract void CommitAssets();
24 24
25 protected abstract void RunRequests(); 25 protected abstract void RunRequests();
26 26
27 public void LoadDefaultAssets() 27 public void LoadDefaultAssets()
28 { 28 {
29 MainLog.Instance.Verbose("SQL ASSET SERVER", "Setting up asset database"); 29 MainLog.Instance.Verbose("SQL ASSET SERVER", "Setting up asset database");
30 30
31 ForEachDefaultAsset(StoreAsset ); 31 ForEachDefaultAsset(StoreAsset );
32 ForEachXmlAsset(StoreAsset ); 32 ForEachXmlAsset(StoreAsset );
33 33
34 CommitAssets(); 34 CommitAssets();
35 } 35 }
36 36
37 37
38 public AssetServerBase() 38 public AssetServerBase()
39 { 39 {
40 System.Console.WriteLine("Starting Db4o asset storage system"); 40 System.Console.WriteLine("Starting Db4o asset storage system");
41 this._assetRequests = new BlockingQueue<ARequest>(); 41 this._assetRequests = new BlockingQueue<ARequest>();
42 42
43 this._localAssetServerThread = new Thread( RunRequests ); 43 this._localAssetServerThread = new Thread( RunRequests );
44 this._localAssetServerThread.IsBackground = true; 44 this._localAssetServerThread.IsBackground = true;
45 this._localAssetServerThread.Start(); 45 this._localAssetServerThread.Start();
46 } 46 }
47 47
48 public void LoadAsset(AssetBase info, bool image, string filename) 48 public void LoadAsset(AssetBase info, bool image, string filename)
49 { 49 {
50 //should request Asset from storage manager 50 //should request Asset from storage manager
51 //but for now read from file 51 //but for now read from file
52 52
53 string dataPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "assets"); //+ folder; 53 string dataPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "assets"); //+ folder;
54 string fileName = Path.Combine(dataPath, filename); 54 string fileName = Path.Combine(dataPath, filename);
55 FileInfo fInfo = new FileInfo(fileName); 55 FileInfo fInfo = new FileInfo(fileName);
56 long numBytes = fInfo.Length; 56 long numBytes = fInfo.Length;
57 FileStream fStream = new FileStream(fileName, FileMode.Open, FileAccess.Read); 57 FileStream fStream = new FileStream(fileName, FileMode.Open, FileAccess.Read);
58 byte[] idata = new byte[numBytes]; 58 byte[] idata = new byte[numBytes];
59 BinaryReader br = new BinaryReader(fStream); 59 BinaryReader br = new BinaryReader(fStream);
60 idata = br.ReadBytes((int)numBytes); 60 idata = br.ReadBytes((int)numBytes);
61 br.Close(); 61 br.Close();
62 fStream.Close(); 62 fStream.Close();
63 info.Data = idata; 63 info.Data = idata;
64 //info.loaded=true; 64 //info.loaded=true;
65 } 65 }
66 66
67 public void SetReceiver(IAssetReceiver receiver) 67 public void SetReceiver(IAssetReceiver receiver)
68 { 68 {
69 this._receiver = receiver; 69 this._receiver = receiver;
70 } 70 }
71 71
72 public void FetchAsset(LLUUID assetID, bool isTexture) 72 public void FetchAsset(LLUUID assetID, bool isTexture)
73 { 73 {
74 ARequest req = new ARequest(); 74 ARequest req = new ARequest();
75 req.AssetID = assetID; 75 req.AssetID = assetID;
76 req.IsTexture = isTexture; 76 req.IsTexture = isTexture;
77 this._assetRequests.Enqueue(req); 77 this._assetRequests.Enqueue(req);
78 } 78 }
79 79
80 public void UpdateAsset(AssetBase asset) 80 public void UpdateAsset(AssetBase asset)
81 { 81 {
82 lock (syncLock) 82 lock (syncLock)
83 { 83 {
84 m_assetProviderPlugin.UpdateAsset(asset); 84 m_assetProviderPlugin.UpdateAsset(asset);
85 m_assetProviderPlugin.CommitAssets(); 85 m_assetProviderPlugin.CommitAssets();
86 } 86 }
87 } 87 }
88 88
89 public void StoreAndCommitAsset(AssetBase asset) 89 public void StoreAndCommitAsset(AssetBase asset)
90 { 90 {
91 lock (syncLock) 91 lock (syncLock)
92 { 92 {
93 StoreAsset(asset); 93 StoreAsset(asset);
94 CommitAssets(); 94 CommitAssets();
95 } 95 }
96 } 96 }
97 97
98 public virtual void Close() 98 public virtual void Close()
99 { 99 {
100 _localAssetServerThread.Abort( ); 100 _localAssetServerThread.Abort( );
101 } 101 }
102 102
103 public void SetServerInfo(string ServerUrl, string ServerKey) 103 public void SetServerInfo(string ServerUrl, string ServerKey)
104 { 104 {
105 105
106 } 106 }
107 107
108 public virtual List<AssetBase> GetDefaultAssets() 108 public virtual List<AssetBase> GetDefaultAssets()
109 { 109 {
110 List<AssetBase> assets = new List<AssetBase>(); 110 List<AssetBase> assets = new List<AssetBase>();
111 111
112 assets.Add(CreateImageAsset("00000000-0000-0000-9999-000000000001", "Bricks", "bricks.jp2")); 112 assets.Add(CreateImageAsset("00000000-0000-0000-9999-000000000001", "Bricks", "bricks.jp2"));
113 assets.Add(CreateImageAsset("00000000-0000-0000-9999-000000000002", "Plywood", "plywood.jp2")); 113 assets.Add(CreateImageAsset("00000000-0000-0000-9999-000000000002", "Plywood", "plywood.jp2"));
114 assets.Add(CreateImageAsset("00000000-0000-0000-9999-000000000003", "Rocks", "rocks.jp2")); 114 assets.Add(CreateImageAsset("00000000-0000-0000-9999-000000000003", "Rocks", "rocks.jp2"));
115 assets.Add(CreateImageAsset("00000000-0000-0000-9999-000000000004", "Granite", "granite.jp2")); 115 assets.Add(CreateImageAsset("00000000-0000-0000-9999-000000000004", "Granite", "granite.jp2"));
116 assets.Add(CreateImageAsset("00000000-0000-0000-9999-000000000005", "Hardwood", "hardwood.jp2")); 116 assets.Add(CreateImageAsset("00000000-0000-0000-9999-000000000005", "Hardwood", "hardwood.jp2"));
117 assets.Add(CreateImageAsset("00000000-0000-0000-5005-000000000005", "Prim Base Texture", "plywood.jp2")); 117 assets.Add(CreateImageAsset("00000000-0000-0000-5005-000000000005", "Prim Base Texture", "plywood.jp2"));
118 assets.Add(CreateImageAsset("00000000-0000-0000-9999-000000000006", "Map Base Texture", "map_base.jp2")); 118 assets.Add(CreateImageAsset("00000000-0000-0000-9999-000000000006", "Map Base Texture", "map_base.jp2"));
119 assets.Add(CreateImageAsset("00000000-0000-0000-9999-000000000007", "Map Texture", "map1.jp2")); 119 assets.Add(CreateImageAsset("00000000-0000-0000-9999-000000000007", "Map Texture", "map1.jp2"));
120 assets.Add(CreateImageAsset("00000000-0000-0000-9999-000000000010", "Female Body Texture", "femalebody.jp2")); 120 assets.Add(CreateImageAsset("00000000-0000-0000-9999-000000000010", "Female Body Texture", "femalebody.jp2"));
121 assets.Add(CreateImageAsset("00000000-0000-0000-9999-000000000011", "Female Bottom Texture", "femalebottom.jp2")); 121 assets.Add(CreateImageAsset("00000000-0000-0000-9999-000000000011", "Female Bottom Texture", "femalebottom.jp2"));
122 assets.Add(CreateImageAsset("00000000-0000-0000-9999-000000000012", "Female Face Texture", "femaleface.jp2")); 122 assets.Add(CreateImageAsset("00000000-0000-0000-9999-000000000012", "Female Face Texture", "femaleface.jp2"));
123 123
124 assets.Add(CreateAsset("77c41e39-38f9-f75a-024e-585989bbabbb", "Skin", "base_skin.dat", false)); 124 assets.Add(CreateAsset("77c41e39-38f9-f75a-024e-585989bbabbb", "Skin", "base_skin.dat", false));
125 assets.Add(CreateAsset("66c41e39-38f9-f75a-024e-585989bfab73", "Shape", "base_shape.dat", false)); 125 assets.Add(CreateAsset("66c41e39-38f9-f75a-024e-585989bfab73", "Shape", "base_shape.dat", false));
126 assets.Add(CreateAsset("00000000-38f9-1111-024e-222222111110", "Shirt", "newshirt.dat", false)); 126 assets.Add(CreateAsset("00000000-38f9-1111-024e-222222111110", "Shirt", "newshirt.dat", false));
127 assets.Add(CreateAsset("00000000-38f9-1111-024e-222222111120", "Shirt", "newpants.dat", false)); 127 assets.Add(CreateAsset("00000000-38f9-1111-024e-222222111120", "Shirt", "newpants.dat", false));
128 128
129 return assets; 129 return assets;
130 } 130 }
131 131
132 public AssetBase CreateImageAsset(string assetIdStr, string name, string filename) 132 public AssetBase CreateImageAsset(string assetIdStr, string name, string filename)
133 { 133 {
134 return CreateAsset(assetIdStr, name, filename, true); 134 return CreateAsset(assetIdStr, name, filename, true);
135 } 135 }
136 136
137 public void ForEachDefaultAsset(Action<AssetBase> action) 137 public void ForEachDefaultAsset(Action<AssetBase> action)
138 { 138 {
139 List<AssetBase> assets = GetDefaultAssets(); 139 List<AssetBase> assets = GetDefaultAssets();
140 assets.ForEach(action); 140 assets.ForEach(action);
141 } 141 }
142 142
143 public AssetBase CreateAsset(string assetIdStr, string name, string filename, bool isImage) 143 public AssetBase CreateAsset(string assetIdStr, string name, string filename, bool isImage)
144 { 144 {
145 AssetBase asset = new AssetBase( 145 AssetBase asset = new AssetBase(
146 new LLUUID(assetIdStr), 146 new LLUUID(assetIdStr),
147 name 147 name
148 ); 148 );
149 149
150 if (!String.IsNullOrEmpty(filename)) 150 if (!String.IsNullOrEmpty(filename))
151 { 151 {
152 MainLog.Instance.Verbose("ASSETS", "Loading: [{0}][{1}]", name, filename ); 152 MainLog.Instance.Verbose("ASSETS", "Loading: [{0}][{1}]", name, filename );
153 153
154 LoadAsset(asset, isImage, filename); 154 LoadAsset(asset, isImage, filename);
155 } 155 }
156 else 156 else
157 { 157 {
158 MainLog.Instance.Verbose("ASSETS", "Instantiated: [{0}]", name ); 158 MainLog.Instance.Verbose("ASSETS", "Instantiated: [{0}]", name );
159 } 159 }
160 160
161 return asset; 161 return asset;
162 } 162 }
163 163
164 public void ForEachXmlAsset(Action<AssetBase> action) 164 public void ForEachXmlAsset(Action<AssetBase> action)
165 { 165 {
166 string filePath = Path.Combine(Util.configDir(), "OpenSimAssetSet.xml"); 166 string filePath = Path.Combine(Util.configDir(), "OpenSimAssetSet.xml");
167 if (File.Exists(filePath)) 167 if (File.Exists(filePath))
168 { 168 {
169 XmlConfigSource source = new XmlConfigSource(filePath); 169 XmlConfigSource source = new XmlConfigSource(filePath);
170 170
171 for (int i = 0; i < source.Configs.Count; i++) 171 for (int i = 0; i < source.Configs.Count; i++)
172 { 172 {
173 string assetIdStr = source.Configs[i].GetString("assetID", LLUUID.Random().ToStringHyphenated()); 173 string assetIdStr = source.Configs[i].GetString("assetID", LLUUID.Random().ToStringHyphenated());
174 string name = source.Configs[i].GetString("name", ""); 174 string name = source.Configs[i].GetString("name", "");
175 sbyte type = (sbyte)source.Configs[i].GetInt("assetType", 0); 175 sbyte type = (sbyte)source.Configs[i].GetInt("assetType", 0);
176 sbyte invType = (sbyte)source.Configs[i].GetInt("inventoryType", 0); 176 sbyte invType = (sbyte)source.Configs[i].GetInt("inventoryType", 0);
177 string fileName = source.Configs[i].GetString("fileName", ""); 177 string fileName = source.Configs[i].GetString("fileName", "");
178 178
179 AssetBase newAsset = CreateAsset(assetIdStr, name, fileName, false); 179 AssetBase newAsset = CreateAsset(assetIdStr, name, fileName, false);
180 180
181 newAsset.Type = type; 181 newAsset.Type = type;
182 newAsset.InvType = invType; 182 newAsset.InvType = invType;
183 183
184 } 184 }
185 } 185 }
186 } 186 }
187 } 187 }
188} \ No newline at end of file 188} \ No newline at end of file
diff --git a/OpenSim/Framework/Communications/Cache/SQLAssetServer.cs b/OpenSim/Framework/Communications/Cache/SQLAssetServer.cs
index 379d609..69f83d2 100644
--- a/OpenSim/Framework/Communications/Cache/SQLAssetServer.cs
+++ b/OpenSim/Framework/Communications/Cache/SQLAssetServer.cs
@@ -1,125 +1,125 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System; 28using System;
29using System.IO; 29using System.IO;
30using System.Threading; 30using System.Threading;
31using System.Reflection; 31using System.Reflection;
32using libsecondlife; 32using libsecondlife;
33using Nini.Config; 33using Nini.Config;
34using OpenSim.Framework.Console; 34using OpenSim.Framework.Console;
35using OpenSim.Framework.Interfaces; 35using OpenSim.Framework.Interfaces;
36using OpenSim.Framework.Types; 36using OpenSim.Framework.Types;
37using OpenSim.Framework.Utilities; 37using OpenSim.Framework.Utilities;
38 38
39namespace OpenSim.Framework.Communications.Cache 39namespace OpenSim.Framework.Communications.Cache
40{ 40{
41 public class SQLAssetServer : AssetServerBase 41 public class SQLAssetServer : AssetServerBase
42 { 42 {
43 public SQLAssetServer(string pluginName) 43 public SQLAssetServer(string pluginName)
44 { 44 {
45 _assetRequests = new BlockingQueue<ARequest>(); 45 _assetRequests = new BlockingQueue<ARequest>();
46 AddPlugin(pluginName); 46 AddPlugin(pluginName);
47 } 47 }
48 48
49 public SQLAssetServer(IAssetProvider assetProvider) 49 public SQLAssetServer(IAssetProvider assetProvider)
50 { 50 {
51 m_assetProviderPlugin = assetProvider; 51 m_assetProviderPlugin = assetProvider;
52 } 52 }
53 53
54 public void AddPlugin(string FileName) 54 public void AddPlugin(string FileName)
55 { 55 {
56 MainLog.Instance.Verbose("SQLAssetServer", "AssetStorage: Attempting to load " + FileName); 56 MainLog.Instance.Verbose("SQLAssetServer", "AssetStorage: Attempting to load " + FileName);
57 Assembly pluginAssembly = Assembly.LoadFrom(FileName); 57 Assembly pluginAssembly = Assembly.LoadFrom(FileName);
58 58
59 foreach (Type pluginType in pluginAssembly.GetTypes()) 59 foreach (Type pluginType in pluginAssembly.GetTypes())
60 { 60 {
61 if (!pluginType.IsAbstract) 61 if (!pluginType.IsAbstract)
62 { 62 {
63 Type typeInterface = pluginType.GetInterface("IAssetProvider", true); 63 Type typeInterface = pluginType.GetInterface("IAssetProvider", true);
64 64
65 if (typeInterface != null) 65 if (typeInterface != null)
66 { 66 {
67 IAssetProvider plug = (IAssetProvider)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); 67 IAssetProvider plug = (IAssetProvider)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
68 m_assetProviderPlugin = plug; 68 m_assetProviderPlugin = plug;
69 m_assetProviderPlugin.Initialise(); 69 m_assetProviderPlugin.Initialise();
70 70
71 MainLog.Instance.Verbose("AssetStorage: Added " + m_assetProviderPlugin.Name + " " + m_assetProviderPlugin.Version); 71 MainLog.Instance.Verbose("AssetStorage: Added " + m_assetProviderPlugin.Name + " " + m_assetProviderPlugin.Version);
72 } 72 }
73 73
74 typeInterface = null; 74 typeInterface = null;
75 } 75 }
76 } 76 }
77 77
78 pluginAssembly = null; 78 pluginAssembly = null;
79 } 79 }
80 80
81 81
82 public override void Close() 82 public override void Close()
83 { 83 {
84 base.Close(); 84 base.Close();
85 85
86 m_assetProviderPlugin.CommitAssets(); 86 m_assetProviderPlugin.CommitAssets();
87 } 87 }
88 88
89 override protected void RunRequests() 89 override protected void RunRequests()
90 { 90 {
91 while (true) 91 while (true)
92 { 92 {
93 ARequest req = this._assetRequests.Dequeue(); 93 ARequest req = this._assetRequests.Dequeue();
94 94
95 MainLog.Instance.Verbose("Requesting asset: " + req.AssetID); 95 MainLog.Instance.Verbose("Requesting asset: " + req.AssetID);
96 96
97 AssetBase asset = null; 97 AssetBase asset = null;
98 lock (syncLock) 98 lock (syncLock)
99 { 99 {
100 asset = m_assetProviderPlugin.FetchAsset(req.AssetID); 100 asset = m_assetProviderPlugin.FetchAsset(req.AssetID);
101 } 101 }
102 if (asset != null) 102 if (asset != null)
103 { 103 {
104 _receiver.AssetReceived(asset, req.IsTexture); 104 _receiver.AssetReceived(asset, req.IsTexture);
105 } 105 }
106 else 106 else
107 { 107 {
108 _receiver.AssetNotFound(req.AssetID); 108 _receiver.AssetNotFound(req.AssetID);
109 } 109 }
110 110
111 } 111 }
112 112
113 } 113 }
114 114
115 protected override void StoreAsset(AssetBase asset) 115 protected override void StoreAsset(AssetBase asset)
116 { 116 {
117 m_assetProviderPlugin.CreateAsset(asset); 117 m_assetProviderPlugin.CreateAsset(asset);
118 } 118 }
119 119
120 protected override void CommitAssets() 120 protected override void CommitAssets()
121 { 121 {
122 m_assetProviderPlugin.CommitAssets(); 122 m_assetProviderPlugin.CommitAssets();
123 } 123 }
124 } 124 }
125} \ No newline at end of file 125} \ No newline at end of file
diff --git a/OpenSim/Framework/Communications/LoginService.cs b/OpenSim/Framework/Communications/LoginService.cs
index 85af5db..674c746 100644
--- a/OpenSim/Framework/Communications/LoginService.cs
+++ b/OpenSim/Framework/Communications/LoginService.cs
@@ -1,315 +1,315 @@
1/* 1/*
2* Copyright (c) Contributors, http://opensimulator.org/ 2* Copyright (c) Contributors, http://opensimulator.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28 28
29using System; 29using System;
30using System.Collections; 30using System.Collections;
31using System.Collections.Generic; 31using System.Collections.Generic;
32using System.Reflection; 32using System.Reflection;
33using System.Security.Cryptography; 33using System.Security.Cryptography;
34using libsecondlife; 34using libsecondlife;
35using Nwc.XmlRpc; 35using Nwc.XmlRpc;
36using OpenSim.Framework.Console; 36using OpenSim.Framework.Console;
37using OpenSim.Framework.Interfaces; 37using OpenSim.Framework.Interfaces;
38using OpenSim.Framework.Inventory; 38using OpenSim.Framework.Inventory;
39using OpenSim.Framework.Types; 39using OpenSim.Framework.Types;
40using OpenSim.Framework.Utilities; 40using OpenSim.Framework.Utilities;
41 41
42using OpenSim.Framework.Configuration; 42using OpenSim.Framework.Configuration;
43using InventoryFolder = OpenSim.Framework.Inventory.InventoryFolder; 43using InventoryFolder = OpenSim.Framework.Inventory.InventoryFolder;
44 44
45namespace OpenSim.Framework.UserManagement 45namespace OpenSim.Framework.UserManagement
46{ 46{
47 public class LoginService 47 public class LoginService
48 { 48 {
49 protected string m_welcomeMessage = "Welcome to OpenSim"; 49 protected string m_welcomeMessage = "Welcome to OpenSim";
50 protected UserManagerBase m_userManager = null; 50 protected UserManagerBase m_userManager = null;
51 51
52 public LoginService(UserManagerBase userManager, string welcomeMess) 52 public LoginService(UserManagerBase userManager, string welcomeMess)
53 { 53 {
54 m_userManager = userManager; 54 m_userManager = userManager;
55 if (welcomeMess != "") 55 if (welcomeMess != "")
56 { 56 {
57 m_welcomeMessage = welcomeMess; 57 m_welcomeMessage = welcomeMess;
58 } 58 }
59 } 59 }
60 60
61 /// <summary> 61 /// <summary>
62 /// Main user login function 62 /// Main user login function
63 /// </summary> 63 /// </summary>
64 /// <param name="request">The XMLRPC request</param> 64 /// <param name="request">The XMLRPC request</param>
65 /// <returns>The response to send</returns> 65 /// <returns>The response to send</returns>
66 public XmlRpcResponse XmlRpcLoginMethod(XmlRpcRequest request) 66 public XmlRpcResponse XmlRpcLoginMethod(XmlRpcRequest request)
67 { 67 {
68 68
69 MainLog.Instance.Verbose("Attempting login now..."); 69 MainLog.Instance.Verbose("Attempting login now...");
70 XmlRpcResponse response = new XmlRpcResponse(); 70 XmlRpcResponse response = new XmlRpcResponse();
71 Hashtable requestData = (Hashtable)request.Params[0]; 71 Hashtable requestData = (Hashtable)request.Params[0];
72 72
73 bool GoodXML = (requestData.Contains("first") && requestData.Contains("last") && requestData.Contains("passwd")); 73 bool GoodXML = (requestData.Contains("first") && requestData.Contains("last") && requestData.Contains("passwd"));
74 bool GoodLogin = false; 74 bool GoodLogin = false;
75 75
76 UserProfileData userProfile; 76 UserProfileData userProfile;
77 LoginResponse logResponse = new LoginResponse(); 77 LoginResponse logResponse = new LoginResponse();
78 78
79 if (GoodXML) 79 if (GoodXML)
80 { 80 {
81 string firstname = (string)requestData["first"]; 81 string firstname = (string)requestData["first"];
82 string lastname = (string)requestData["last"]; 82 string lastname = (string)requestData["last"];
83 string passwd = (string)requestData["passwd"]; 83 string passwd = (string)requestData["passwd"];
84 84
85 userProfile = GetTheUser(firstname, lastname); 85 userProfile = GetTheUser(firstname, lastname);
86 if (userProfile == null) 86 if (userProfile == null)
87 return logResponse.CreateLoginFailedResponse(); 87 return logResponse.CreateLoginFailedResponse();
88 88
89 GoodLogin = AuthenticateUser(userProfile, passwd); 89 GoodLogin = AuthenticateUser(userProfile, passwd);
90 } 90 }
91 else 91 else
92 { 92 {
93 return logResponse.CreateGridErrorResponse(); 93 return logResponse.CreateGridErrorResponse();
94 } 94 }
95 95
96 if (!GoodLogin) 96 if (!GoodLogin)
97 { 97 {
98 return logResponse.CreateLoginFailedResponse(); 98 return logResponse.CreateLoginFailedResponse();
99 } 99 }
100 else 100 else
101 { 101 {
102 // If we already have a session... 102 // If we already have a session...
103 if (userProfile.currentAgent != null && userProfile.currentAgent.agentOnline) 103 if (userProfile.currentAgent != null && userProfile.currentAgent.agentOnline)
104 { 104 {
105 // Reject the login 105 // Reject the login
106 return logResponse.CreateAlreadyLoggedInResponse(); 106 return logResponse.CreateAlreadyLoggedInResponse();
107 } 107 }
108 // Otherwise... 108 // Otherwise...
109 // Create a new agent session 109 // Create a new agent session
110 CreateAgent(userProfile, request); 110 CreateAgent(userProfile, request);
111 111
112 try 112 try
113 { 113 {
114 LLUUID agentID = userProfile.UUID; 114 LLUUID agentID = userProfile.UUID;
115 115
116 // Inventory Library Section 116 // Inventory Library Section
117 InventoryData inventData = this.CreateInventoryData(agentID); 117 InventoryData inventData = this.CreateInventoryData(agentID);
118 ArrayList AgentInventoryArray = inventData.InventoryArray; 118 ArrayList AgentInventoryArray = inventData.InventoryArray;
119 119
120 Hashtable InventoryRootHash = new Hashtable(); 120 Hashtable InventoryRootHash = new Hashtable();
121 InventoryRootHash["folder_id"] = inventData.RootFolderID.ToStringHyphenated(); 121 InventoryRootHash["folder_id"] = inventData.RootFolderID.ToStringHyphenated();
122 ArrayList InventoryRoot = new ArrayList(); 122 ArrayList InventoryRoot = new ArrayList();
123 InventoryRoot.Add(InventoryRootHash); 123 InventoryRoot.Add(InventoryRootHash);
124 userProfile.rootInventoryFolderID = inventData.RootFolderID; 124 userProfile.rootInventoryFolderID = inventData.RootFolderID;
125 125
126 // Circuit Code 126 // Circuit Code
127 uint circode = (uint)(Util.RandomClass.Next()); 127 uint circode = (uint)(Util.RandomClass.Next());
128 128
129 logResponse.Lastname = userProfile.surname; 129 logResponse.Lastname = userProfile.surname;
130 logResponse.Firstname = userProfile.username; 130 logResponse.Firstname = userProfile.username;
131 logResponse.AgentID = agentID.ToStringHyphenated(); 131 logResponse.AgentID = agentID.ToStringHyphenated();
132 logResponse.SessionID = userProfile.currentAgent.sessionID.ToStringHyphenated(); 132 logResponse.SessionID = userProfile.currentAgent.sessionID.ToStringHyphenated();
133 logResponse.SecureSessionID = userProfile.currentAgent.secureSessionID.ToStringHyphenated(); 133 logResponse.SecureSessionID = userProfile.currentAgent.secureSessionID.ToStringHyphenated();
134 logResponse.InventoryRoot = InventoryRoot; 134 logResponse.InventoryRoot = InventoryRoot;
135 logResponse.InventorySkeleton = AgentInventoryArray; 135 logResponse.InventorySkeleton = AgentInventoryArray;
136 logResponse.InventoryLibrary = this.GetInventoryLibrary(); 136 logResponse.InventoryLibrary = this.GetInventoryLibrary();
137 logResponse.InventoryLibraryOwner = this.GetLibraryOwner(); 137 logResponse.InventoryLibraryOwner = this.GetLibraryOwner();
138 logResponse.CircuitCode = (Int32)circode; 138 logResponse.CircuitCode = (Int32)circode;
139 //logResponse.RegionX = 0; //overwritten 139 //logResponse.RegionX = 0; //overwritten
140 //logResponse.RegionY = 0; //overwritten 140 //logResponse.RegionY = 0; //overwritten
141 logResponse.Home = "!!null temporary value {home}!!"; // Overwritten 141 logResponse.Home = "!!null temporary value {home}!!"; // Overwritten
142 //logResponse.LookAt = "\n[r" + TheUser.homeLookAt.X.ToString() + ",r" + TheUser.homeLookAt.Y.ToString() + ",r" + TheUser.homeLookAt.Z.ToString() + "]\n"; 142 //logResponse.LookAt = "\n[r" + TheUser.homeLookAt.X.ToString() + ",r" + TheUser.homeLookAt.Y.ToString() + ",r" + TheUser.homeLookAt.Z.ToString() + "]\n";
143 //logResponse.SimAddress = "127.0.0.1"; //overwritten 143 //logResponse.SimAddress = "127.0.0.1"; //overwritten
144 //logResponse.SimPort = 0; //overwritten 144 //logResponse.SimPort = 0; //overwritten
145 logResponse.Message = this.GetMessage(); 145 logResponse.Message = this.GetMessage();
146 146
147 try 147 try
148 { 148 {
149 this.CustomiseResponse(logResponse, userProfile); 149 this.CustomiseResponse(logResponse, userProfile);
150 } 150 }
151 catch (Exception e) 151 catch (Exception e)
152 { 152 {
153 MainLog.Instance.Verbose(e.ToString()); 153 MainLog.Instance.Verbose(e.ToString());
154 return logResponse.CreateDeadRegionResponse(); 154 return logResponse.CreateDeadRegionResponse();
155 //return logResponse.ToXmlRpcResponse(); 155 //return logResponse.ToXmlRpcResponse();
156 } 156 }
157 CommitAgent(ref userProfile); 157 CommitAgent(ref userProfile);
158 return logResponse.ToXmlRpcResponse(); 158 return logResponse.ToXmlRpcResponse();
159 159
160 } 160 }
161 161
162 catch (Exception E) 162 catch (Exception E)
163 { 163 {
164 MainLog.Instance.Verbose(E.ToString()); 164 MainLog.Instance.Verbose(E.ToString());
165 } 165 }
166 //} 166 //}
167 } 167 }
168 return response; 168 return response;
169 169
170 } 170 }
171 171
172 /// <summary> 172 /// <summary>
173 /// Customises the login response and fills in missing values. 173 /// Customises the login response and fills in missing values.
174 /// </summary> 174 /// </summary>
175 /// <param name="response">The existing response</param> 175 /// <param name="response">The existing response</param>
176 /// <param name="theUser">The user profile</param> 176 /// <param name="theUser">The user profile</param>
177 public virtual void CustomiseResponse(LoginResponse response, UserProfileData theUser) 177 public virtual void CustomiseResponse(LoginResponse response, UserProfileData theUser)
178 { 178 {
179 } 179 }
180 180
181 /// <summary> 181 /// <summary>
182 /// Saves a target agent to the database 182 /// Saves a target agent to the database
183 /// </summary> 183 /// </summary>
184 /// <param name="profile">The users profile</param> 184 /// <param name="profile">The users profile</param>
185 /// <returns>Successful?</returns> 185 /// <returns>Successful?</returns>
186 public bool CommitAgent(ref UserProfileData profile) 186 public bool CommitAgent(ref UserProfileData profile)
187 { 187 {
188 // Saves the agent to database 188 // Saves the agent to database
189 return true; 189 return true;
190 } 190 }
191 191
192 192
193 /// <summary> 193 /// <summary>
194 /// Checks a user against it's password hash 194 /// Checks a user against it's password hash
195 /// </summary> 195 /// </summary>
196 /// <param name="profile">The users profile</param> 196 /// <param name="profile">The users profile</param>
197 /// <param name="password">The supplied password</param> 197 /// <param name="password">The supplied password</param>
198 /// <returns>Authenticated?</returns> 198 /// <returns>Authenticated?</returns>
199 public virtual bool AuthenticateUser(UserProfileData profile, string password) 199 public virtual bool AuthenticateUser(UserProfileData profile, string password)
200 { 200 {
201 201
202 MainLog.Instance.Verbose( 202 MainLog.Instance.Verbose(
203 "Authenticating " + profile.username + " " + profile.surname); 203 "Authenticating " + profile.username + " " + profile.surname);
204 204
205 password = password.Remove(0, 3); //remove $1$ 205 password = password.Remove(0, 3); //remove $1$
206 206
207 string s = Util.Md5Hash(password + ":" + profile.passwordSalt); 207 string s = Util.Md5Hash(password + ":" + profile.passwordSalt);
208 208
209 return profile.passwordHash.Equals(s.ToString(), StringComparison.InvariantCultureIgnoreCase); 209 return profile.passwordHash.Equals(s.ToString(), StringComparison.InvariantCultureIgnoreCase);
210 } 210 }
211 211
212 /// <summary> 212 /// <summary>
213 /// 213 ///
214 /// </summary> 214 /// </summary>
215 /// <param name="profile"></param> 215 /// <param name="profile"></param>
216 /// <param name="request"></param> 216 /// <param name="request"></param>
217 public void CreateAgent(UserProfileData profile, XmlRpcRequest request) 217 public void CreateAgent(UserProfileData profile, XmlRpcRequest request)
218 { 218 {
219 this.m_userManager.CreateAgent(profile, request); 219 this.m_userManager.CreateAgent(profile, request);
220 } 220 }
221 221
222 /// <summary> 222 /// <summary>
223 /// 223 ///
224 /// </summary> 224 /// </summary>
225 /// <param name="firstname"></param> 225 /// <param name="firstname"></param>
226 /// <param name="lastname"></param> 226 /// <param name="lastname"></param>
227 /// <returns></returns> 227 /// <returns></returns>
228 public virtual UserProfileData GetTheUser(string firstname, string lastname) 228 public virtual UserProfileData GetTheUser(string firstname, string lastname)
229 { 229 {
230 return this.m_userManager.GetUserProfile(firstname, lastname); 230 return this.m_userManager.GetUserProfile(firstname, lastname);
231 } 231 }
232 232
233 /// <summary> 233 /// <summary>
234 /// 234 ///
235 /// </summary> 235 /// </summary>
236 /// <returns></returns> 236 /// <returns></returns>
237 public virtual string GetMessage() 237 public virtual string GetMessage()
238 { 238 {
239 return m_welcomeMessage; 239 return m_welcomeMessage;
240 } 240 }
241 241
242 /// <summary> 242 /// <summary>
243 /// 243 ///
244 /// </summary> 244 /// </summary>
245 /// <returns></returns> 245 /// <returns></returns>
246 protected virtual ArrayList GetInventoryLibrary() 246 protected virtual ArrayList GetInventoryLibrary()
247 { 247 {
248 //return new ArrayList(); 248 //return new ArrayList();
249 Hashtable TempHash = new Hashtable(); 249 Hashtable TempHash = new Hashtable();
250 TempHash["name"] = "OpenSim Library"; 250 TempHash["name"] = "OpenSim Library";
251 TempHash["parent_id"] = LLUUID.Zero.ToStringHyphenated(); 251 TempHash["parent_id"] = LLUUID.Zero.ToStringHyphenated();
252 TempHash["version"] = 1; 252 TempHash["version"] = 1;
253 TempHash["type_default"] = -1; 253 TempHash["type_default"] = -1;
254 TempHash["folder_id"] = "00000112-000f-0000-0000-000100bba000"; 254 TempHash["folder_id"] = "00000112-000f-0000-0000-000100bba000";
255 ArrayList temp = new ArrayList(); 255 ArrayList temp = new ArrayList();
256 temp.Add(TempHash); 256 temp.Add(TempHash);
257 257
258 TempHash = new Hashtable(); 258 TempHash = new Hashtable();
259 TempHash["name"] = "Texture Library"; 259 TempHash["name"] = "Texture Library";
260 TempHash["parent_id"] = "00000112-000f-0000-0000-000100bba000"; 260 TempHash["parent_id"] = "00000112-000f-0000-0000-000100bba000";
261 TempHash["version"] = 1; 261 TempHash["version"] = 1;
262 TempHash["type_default"] = -1; 262 TempHash["type_default"] = -1;
263 TempHash["folder_id"] = "00000112-000f-0000-0000-000100bba001"; 263 TempHash["folder_id"] = "00000112-000f-0000-0000-000100bba001";
264 temp.Add(TempHash); 264 temp.Add(TempHash);
265 return temp; 265 return temp;
266 } 266 }
267 267
268 /// <summary> 268 /// <summary>
269 /// 269 ///
270 /// </summary> 270 /// </summary>
271 /// <returns></returns> 271 /// <returns></returns>
272 protected virtual ArrayList GetLibraryOwner() 272 protected virtual ArrayList GetLibraryOwner()
273 { 273 {
274 //for now create random inventory library owner 274 //for now create random inventory library owner
275 Hashtable TempHash = new Hashtable(); 275 Hashtable TempHash = new Hashtable();
276 TempHash["agent_id"] = "11111111-1111-0000-0000-000100bba000"; 276 TempHash["agent_id"] = "11111111-1111-0000-0000-000100bba000";
277 ArrayList inventoryLibOwner = new ArrayList(); 277 ArrayList inventoryLibOwner = new ArrayList();
278 inventoryLibOwner.Add(TempHash); 278 inventoryLibOwner.Add(TempHash);
279 return inventoryLibOwner; 279 return inventoryLibOwner;
280 } 280 }
281 281
282 protected virtual InventoryData CreateInventoryData(LLUUID userID) 282 protected virtual InventoryData CreateInventoryData(LLUUID userID)
283 { 283 {
284 AgentInventory userInventory = new AgentInventory(); 284 AgentInventory userInventory = new AgentInventory();
285 userInventory.CreateRootFolder(userID, false); 285 userInventory.CreateRootFolder(userID, false);
286 286
287 ArrayList AgentInventoryArray = new ArrayList(); 287 ArrayList AgentInventoryArray = new ArrayList();
288 Hashtable TempHash; 288 Hashtable TempHash;
289 foreach (InventoryFolder InvFolder in userInventory.InventoryFolders.Values) 289 foreach (InventoryFolder InvFolder in userInventory.InventoryFolders.Values)
290 { 290 {
291 TempHash = new Hashtable(); 291 TempHash = new Hashtable();
292 TempHash["name"] = InvFolder.FolderName; 292 TempHash["name"] = InvFolder.FolderName;
293 TempHash["parent_id"] = InvFolder.ParentID.ToStringHyphenated(); 293 TempHash["parent_id"] = InvFolder.ParentID.ToStringHyphenated();
294 TempHash["version"] = (Int32)InvFolder.Version; 294 TempHash["version"] = (Int32)InvFolder.Version;
295 TempHash["type_default"] = (Int32)InvFolder.DefaultType; 295 TempHash["type_default"] = (Int32)InvFolder.DefaultType;
296 TempHash["folder_id"] = InvFolder.FolderID.ToStringHyphenated(); 296 TempHash["folder_id"] = InvFolder.FolderID.ToStringHyphenated();
297 AgentInventoryArray.Add(TempHash); 297 AgentInventoryArray.Add(TempHash);
298 } 298 }
299 299
300 return new InventoryData(AgentInventoryArray, userInventory.InventoryRoot.FolderID); 300 return new InventoryData(AgentInventoryArray, userInventory.InventoryRoot.FolderID);
301 } 301 }
302 302
303 public class InventoryData 303 public class InventoryData
304 { 304 {
305 public ArrayList InventoryArray = null; 305 public ArrayList InventoryArray = null;
306 public LLUUID RootFolderID = LLUUID.Zero; 306 public LLUUID RootFolderID = LLUUID.Zero;
307 307
308 public InventoryData(ArrayList invList, LLUUID rootID) 308 public InventoryData(ArrayList invList, LLUUID rootID)
309 { 309 {
310 InventoryArray = invList; 310 InventoryArray = invList;
311 RootFolderID = rootID; 311 RootFolderID = rootID;
312 } 312 }
313 } 313 }
314 } 314 }
315} 315}
diff --git a/OpenSim/Framework/Data.MySQL/MySQLAssetData.cs b/OpenSim/Framework/Data.MySQL/MySQLAssetData.cs
index 5bae4ec..a8f0fdb 100644
--- a/OpenSim/Framework/Data.MySQL/MySQLAssetData.cs
+++ b/OpenSim/Framework/Data.MySQL/MySQLAssetData.cs
@@ -1,159 +1,159 @@
1/* 1/*
2* Copyright (c) Contributors, http://opensimulator.org/ 2* Copyright (c) Contributors, http://opensimulator.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28 28
29using System; 29using System;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using MySql.Data.MySqlClient; 31using MySql.Data.MySqlClient;
32 32
33using libsecondlife; 33using libsecondlife;
34using OpenSim.Framework.Console; 34using OpenSim.Framework.Console;
35using OpenSim.Framework.Interfaces; 35using OpenSim.Framework.Interfaces;
36using OpenSim.Framework.Types; 36using OpenSim.Framework.Types;
37 37
38namespace OpenSim.Framework.Data.MySQL 38namespace OpenSim.Framework.Data.MySQL
39{ 39{
40 class MySQLAssetData : IAssetProvider 40 class MySQLAssetData : IAssetProvider
41 { 41 {
42 MySQLManager _dbConnection; 42 MySQLManager _dbConnection;
43 #region IAssetProvider Members 43 #region IAssetProvider Members
44 44
45 private void UpgradeAssetsTable(string oldVersion) 45 private void UpgradeAssetsTable(string oldVersion)
46 { 46 {
47 // null as the version, indicates that the table didn't exist 47 // null as the version, indicates that the table didn't exist
48 if (oldVersion == null) 48 if (oldVersion == null)
49 { 49 {
50 MainLog.Instance.Notice("ASSETS", "Creating new database tables"); 50 MainLog.Instance.Notice("ASSETS", "Creating new database tables");
51 _dbConnection.ExecuteResourceSql("CreateAssetsTable.sql"); 51 _dbConnection.ExecuteResourceSql("CreateAssetsTable.sql");
52 return; 52 return;
53 } 53 }
54 } 54 }
55 55
56 /// <summary> 56 /// <summary>
57 /// Ensure that the assets related tables exists and are at the latest version 57 /// Ensure that the assets related tables exists and are at the latest version
58 /// </summary> 58 /// </summary>
59 private void TestTables() 59 private void TestTables()
60 { 60 {
61 61
62 Dictionary<string, string> tableList = new Dictionary<string, string>(); 62 Dictionary<string, string> tableList = new Dictionary<string, string>();
63 63
64 tableList["assets"] = null; 64 tableList["assets"] = null;
65 _dbConnection.GetTableVersion(tableList); 65 _dbConnection.GetTableVersion(tableList);
66 66
67 UpgradeAssetsTable(tableList["assets"]); 67 UpgradeAssetsTable(tableList["assets"]);
68 68
69 } 69 }
70 70
71 public AssetBase FetchAsset(LLUUID assetID) 71 public AssetBase FetchAsset(LLUUID assetID)
72 { 72 {
73 AssetBase asset = null; 73 AssetBase asset = null;
74 74
75 MySqlCommand cmd = new MySqlCommand("SELECT name, description, assetType, invType, local, temporary, data FROM assets WHERE id=?id", _dbConnection.Connection); 75 MySqlCommand cmd = new MySqlCommand("SELECT name, description, assetType, invType, local, temporary, data FROM assets WHERE id=?id", _dbConnection.Connection);
76 MySqlParameter p = cmd.Parameters.Add("?id", MySqlDbType.Binary, 16); 76 MySqlParameter p = cmd.Parameters.Add("?id", MySqlDbType.Binary, 16);
77 p.Value = assetID.GetBytes(); 77 p.Value = assetID.GetBytes();
78 using (MySqlDataReader dbReader = cmd.ExecuteReader(System.Data.CommandBehavior.SingleRow)) 78 using (MySqlDataReader dbReader = cmd.ExecuteReader(System.Data.CommandBehavior.SingleRow))
79 { 79 {
80 if (dbReader.Read()) 80 if (dbReader.Read())
81 { 81 {
82 asset = new AssetBase(); 82 asset = new AssetBase();
83 asset.Data = (byte[])dbReader["data"]; 83 asset.Data = (byte[])dbReader["data"];
84 asset.Description = (string)dbReader["description"]; 84 asset.Description = (string)dbReader["description"];
85 asset.FullID = assetID; 85 asset.FullID = assetID;
86 asset.InvType = (sbyte)dbReader["invType"]; 86 asset.InvType = (sbyte)dbReader["invType"];
87 asset.Local = ((sbyte)dbReader["local"]) != 0 ? true : false; 87 asset.Local = ((sbyte)dbReader["local"]) != 0 ? true : false;
88 asset.Name = (string)dbReader["name"]; 88 asset.Name = (string)dbReader["name"];
89 asset.Type = (sbyte)dbReader["assetType"]; 89 asset.Type = (sbyte)dbReader["assetType"];
90 } 90 }
91 } 91 }
92 return asset; 92 return asset;
93 } 93 }
94 94
95 public void CreateAsset(AssetBase asset) 95 public void CreateAsset(AssetBase asset)
96 { 96 {
97 MySqlCommand cmd = new MySqlCommand("REPLACE INTO assets(id, name, description, assetType, invType, local, temporary, data)" + 97 MySqlCommand cmd = new MySqlCommand("REPLACE INTO assets(id, name, description, assetType, invType, local, temporary, data)" +
98 "VALUES(?id, ?name, ?description, ?assetType, ?invType, ?local, ?temporary, ?data)", _dbConnection.Connection); 98 "VALUES(?id, ?name, ?description, ?assetType, ?invType, ?local, ?temporary, ?data)", _dbConnection.Connection);
99 MySqlParameter p = cmd.Parameters.Add("?id", MySqlDbType.Binary, 16); 99 MySqlParameter p = cmd.Parameters.Add("?id", MySqlDbType.Binary, 16);
100 p.Value = asset.FullID.GetBytes(); 100 p.Value = asset.FullID.GetBytes();
101 cmd.Parameters.AddWithValue("?name", asset.Name); 101 cmd.Parameters.AddWithValue("?name", asset.Name);
102 cmd.Parameters.AddWithValue("?description", asset.Description); 102 cmd.Parameters.AddWithValue("?description", asset.Description);
103 cmd.Parameters.AddWithValue("?assetType", asset.Type); 103 cmd.Parameters.AddWithValue("?assetType", asset.Type);
104 cmd.Parameters.AddWithValue("?invType", asset.InvType); 104 cmd.Parameters.AddWithValue("?invType", asset.InvType);
105 cmd.Parameters.AddWithValue("?local", asset.Local); 105 cmd.Parameters.AddWithValue("?local", asset.Local);
106 cmd.Parameters.AddWithValue("?temporary", asset.Temporary); 106 cmd.Parameters.AddWithValue("?temporary", asset.Temporary);
107 cmd.Parameters.AddWithValue("?data", asset.Data); 107 cmd.Parameters.AddWithValue("?data", asset.Data);
108 cmd.ExecuteNonQuery(); 108 cmd.ExecuteNonQuery();
109 } 109 }
110 110
111 public void UpdateAsset(AssetBase asset) 111 public void UpdateAsset(AssetBase asset)
112 { 112 {
113 CreateAsset(asset); 113 CreateAsset(asset);
114 } 114 }
115 115
116 public bool ExistsAsset(LLUUID uuid) 116 public bool ExistsAsset(LLUUID uuid)
117 { 117 {
118 throw new Exception("The method or operation is not implemented."); 118 throw new Exception("The method or operation is not implemented.");
119 } 119 }
120 120
121 /// <summary> 121 /// <summary>
122 /// All writes are immediately commited to the database, so this is a no-op 122 /// All writes are immediately commited to the database, so this is a no-op
123 /// </summary> 123 /// </summary>
124 public void CommitAssets() 124 public void CommitAssets()
125 { 125 {
126 } 126 }
127 127
128 #endregion 128 #endregion
129 129
130 #region IPlugin Members 130 #region IPlugin Members
131 131
132 public void Initialise() 132 public void Initialise()
133 { 133 {
134 IniFile GridDataMySqlFile = new IniFile("mysql_connection.ini"); 134 IniFile GridDataMySqlFile = new IniFile("mysql_connection.ini");
135 string hostname = GridDataMySqlFile.ParseFileReadValue("hostname"); 135 string hostname = GridDataMySqlFile.ParseFileReadValue("hostname");
136 string database = GridDataMySqlFile.ParseFileReadValue("database"); 136 string database = GridDataMySqlFile.ParseFileReadValue("database");
137 string username = GridDataMySqlFile.ParseFileReadValue("username"); 137 string username = GridDataMySqlFile.ParseFileReadValue("username");
138 string password = GridDataMySqlFile.ParseFileReadValue("password"); 138 string password = GridDataMySqlFile.ParseFileReadValue("password");
139 string pooling = GridDataMySqlFile.ParseFileReadValue("pooling"); 139 string pooling = GridDataMySqlFile.ParseFileReadValue("pooling");
140 string port = GridDataMySqlFile.ParseFileReadValue("port"); 140 string port = GridDataMySqlFile.ParseFileReadValue("port");
141 141
142 _dbConnection = new MySQLManager(hostname, database, username, password, pooling, port); 142 _dbConnection = new MySQLManager(hostname, database, username, password, pooling, port);
143 143
144 TestTables(); 144 TestTables();
145 } 145 }
146 146
147 public string Version 147 public string Version
148 { 148 {
149 get { return _dbConnection.getVersion(); } 149 get { return _dbConnection.getVersion(); }
150 } 150 }
151 151
152 public string Name 152 public string Name
153 { 153 {
154 get { return "MySQL Asset storage engine"; } 154 get { return "MySQL Asset storage engine"; }
155 } 155 }
156 156
157 #endregion 157 #endregion
158 } 158 }
159} 159}
diff --git a/OpenSim/Framework/General/Configuration/AssetConfig.cs b/OpenSim/Framework/General/Configuration/AssetConfig.cs
index a7c87ad..c4e1cc4 100644
--- a/OpenSim/Framework/General/Configuration/AssetConfig.cs
+++ b/OpenSim/Framework/General/Configuration/AssetConfig.cs
@@ -1,83 +1,83 @@
1/* 1/*
2* Copyright (c) Contributors, http://opensimulator.org/ 2* Copyright (c) Contributors, http://opensimulator.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28 28
29using System; 29using System;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Text; 31using System.Text;
32 32
33namespace OpenSim.Framework.Configuration 33namespace OpenSim.Framework.Configuration
34{ 34{
35 /// <summary> 35 /// <summary>
36 /// UserConfig -- For User Server Configuration 36 /// UserConfig -- For User Server Configuration
37 /// </summary> 37 /// </summary>
38 public class AssetConfig 38 public class AssetConfig
39 { 39 {
40 public string DefaultStartupMsg = ""; 40 public string DefaultStartupMsg = "";
41 41
42 public string DatabaseProvider = ""; 42 public string DatabaseProvider = "";
43 43
44 public static uint DefaultHttpPort = 8003; 44 public static uint DefaultHttpPort = 8003;
45 public uint HttpPort = DefaultHttpPort; 45 public uint HttpPort = DefaultHttpPort;
46 46
47 private ConfigurationMember configMember; 47 private ConfigurationMember configMember;
48 48
49 public AssetConfig(string description, string filename) 49 public AssetConfig(string description, string filename)
50 { 50 {
51 configMember = new ConfigurationMember(filename, description, this.loadConfigurationOptions, this.handleIncomingConfiguration); 51 configMember = new ConfigurationMember(filename, description, this.loadConfigurationOptions, this.handleIncomingConfiguration);
52 configMember.performConfigurationRetrieve(); 52 configMember.performConfigurationRetrieve();
53 } 53 }
54 54
55 public void loadConfigurationOptions() 55 public void loadConfigurationOptions()
56 { 56 {
57 configMember.addConfigurationOption("default_startup_message", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "Default Startup Message", "Welcome to OGS", false); 57 configMember.addConfigurationOption("default_startup_message", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "Default Startup Message", "Welcome to OGS", false);
58 58
59 configMember.addConfigurationOption("database_provider", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "DLL for database provider", "OpenSim.Framework.Data.MySQL.dll", false); 59 configMember.addConfigurationOption("database_provider", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "DLL for database provider", "OpenSim.Framework.Data.MySQL.dll", false);
60 60
61 configMember.addConfigurationOption("http_port", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, "Http Listener port", DefaultHttpPort.ToString(), false); 61 configMember.addConfigurationOption("http_port", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, "Http Listener port", DefaultHttpPort.ToString(), false);
62 62
63 } 63 }
64 64
65 public bool handleIncomingConfiguration(string configuration_key, object configuration_result) 65 public bool handleIncomingConfiguration(string configuration_key, object configuration_result)
66 { 66 {
67 switch (configuration_key) 67 switch (configuration_key)
68 { 68 {
69 case "default_startup_message": 69 case "default_startup_message":
70 this.DefaultStartupMsg = (string)configuration_result; 70 this.DefaultStartupMsg = (string)configuration_result;
71 break; 71 break;
72 case "database_provider": 72 case "database_provider":
73 this.DatabaseProvider = (string)configuration_result; 73 this.DatabaseProvider = (string)configuration_result;
74 break; 74 break;
75 case "http_port": 75 case "http_port":
76 HttpPort = (uint)configuration_result; 76 HttpPort = (uint)configuration_result;
77 break; 77 break;
78 } 78 }
79 79
80 return true; 80 return true;
81 } 81 }
82 } 82 }
83} 83}
diff --git a/OpenSim/Framework/General/Interfaces/IPlugin.cs b/OpenSim/Framework/General/Interfaces/IPlugin.cs
index ce15d40..efd94c9 100644
--- a/OpenSim/Framework/General/Interfaces/IPlugin.cs
+++ b/OpenSim/Framework/General/Interfaces/IPlugin.cs
@@ -1,57 +1,57 @@
1/* 1/*
2* Copyright (c) Contributors, http://opensimulator.org/ 2* Copyright (c) Contributors, http://opensimulator.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28 28
29using System; 29using System;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Text; 31using System.Text;
32 32
33namespace OpenSim.Framework.Interfaces 33namespace OpenSim.Framework.Interfaces
34{ 34{
35 /// <summary> 35 /// <summary>
36 /// This interface, describes a generic plugin 36 /// This interface, describes a generic plugin
37 /// </summary> 37 /// </summary>
38 public interface IPlugin 38 public interface IPlugin
39 { 39 {
40 /// <summary> 40 /// <summary>
41 /// Returns the plugin version 41 /// Returns the plugin version
42 /// </summary> 42 /// </summary>
43 /// <returns>Plugin version in MAJOR.MINOR.REVISION.BUILD format</returns> 43 /// <returns>Plugin version in MAJOR.MINOR.REVISION.BUILD format</returns>
44 string Version { get; } 44 string Version { get; }
45 45
46 /// <summary> 46 /// <summary>
47 /// Returns the plugin name 47 /// Returns the plugin name
48 /// </summary> 48 /// </summary>
49 /// <returns>Plugin name, eg MySQL User Provider</returns> 49 /// <returns>Plugin name, eg MySQL User Provider</returns>
50 string Name { get; } 50 string Name { get; }
51 51
52 /// <summary> 52 /// <summary>
53 /// Initialises the plugin (artificial constructor) 53 /// Initialises the plugin (artificial constructor)
54 /// </summary> 54 /// </summary>
55 void Initialise(); 55 void Initialise();
56 } 56 }
57} 57}
diff --git a/OpenSim/Grid/ScriptEngine/Common/Properties/AssemblyInfo.cs b/OpenSim/Grid/ScriptEngine/Common/Properties/AssemblyInfo.cs
index 6b5d3a8..44a4f29 100644
--- a/OpenSim/Grid/ScriptEngine/Common/Properties/AssemblyInfo.cs
+++ b/OpenSim/Grid/ScriptEngine/Common/Properties/AssemblyInfo.cs
@@ -4,11 +4,11 @@ using System.Runtime.InteropServices;
4 4
5// General Information about an assembly is controlled through the following 5// General Information about an assembly is controlled through the following
6// set of attributes. Change these attribute values to modify the information 6// set of attributes. Change these attribute values to modify the information
7// associated with an assembly. 7// associated with an assembly.
8[assembly: AssemblyTitle("OpenSim.Grid.ScriptEngine.Common")] 8[assembly: AssemblyTitle("OpenSim.Grid.ScriptEngine.Common")]
9[assembly: AssemblyDescription("")] 9[assembly: AssemblyDescription("")]
10[assembly: AssemblyConfiguration("")] 10[assembly: AssemblyConfiguration("")]
11[assembly: AssemblyCompany("")] 11[assembly: AssemblyCompany("")]
12[assembly: AssemblyProduct("OpenSim.Grid.ScriptEngine.Common")] 12[assembly: AssemblyProduct("OpenSim.Grid.ScriptEngine.Common")]
13[assembly: AssemblyCopyright("Copyright © 2007")] 13[assembly: AssemblyCopyright("Copyright © 2007")]
14[assembly: AssemblyTrademark("")] 14[assembly: AssemblyTrademark("")]
diff --git a/OpenSim/Grid/ScriptServer/ScriptServer/Region/RegionBase.cs b/OpenSim/Grid/ScriptServer/ScriptServer/Region/RegionBase.cs
index b9a5c97..b18bda2 100644
--- a/OpenSim/Grid/ScriptServer/ScriptServer/Region/RegionBase.cs
+++ b/OpenSim/Grid/ScriptServer/ScriptServer/Region/RegionBase.cs
@@ -1,114 +1,114 @@
1/* 1/*
2* Copyright (c) Contributors, http://opensimulator.org/ 2* Copyright (c) Contributors, http://opensimulator.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28 28
29using System; 29using System;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Text; 31using System.Text;
32 32
33namespace OpenSim.Grid.ScriptServer 33namespace OpenSim.Grid.ScriptServer
34{ 34{
35 public abstract class RegionBase 35 public abstract class RegionBase
36 { 36 {
37 // These are events that the region needs to have 37 // These are events that the region needs to have
38 38
39 // TEMP: Using System.Delegate -- needs replacing with a real delegate 39 // TEMP: Using System.Delegate -- needs replacing with a real delegate
40 public delegate void DefaultDelegate(); 40 public delegate void DefaultDelegate();
41 41
42 public event DefaultDelegate onScriptRez; 42 public event DefaultDelegate onScriptRez;
43 public event DefaultDelegate onstate_entry; 43 public event DefaultDelegate onstate_entry;
44 public event DefaultDelegate onstate_exit; 44 public event DefaultDelegate onstate_exit;
45 public event DefaultDelegate ontouch_start; 45 public event DefaultDelegate ontouch_start;
46 public event DefaultDelegate ontouch; 46 public event DefaultDelegate ontouch;
47 public event DefaultDelegate ontouch_end; 47 public event DefaultDelegate ontouch_end;
48 public event DefaultDelegate oncollision_start; 48 public event DefaultDelegate oncollision_start;
49 public event DefaultDelegate oncollision; 49 public event DefaultDelegate oncollision;
50 public event DefaultDelegate oncollision_end; 50 public event DefaultDelegate oncollision_end;
51 public event DefaultDelegate onland_collision_start; 51 public event DefaultDelegate onland_collision_start;
52 public event DefaultDelegate onland_collision; 52 public event DefaultDelegate onland_collision;
53 public event DefaultDelegate onland_collision_end; 53 public event DefaultDelegate onland_collision_end;
54 public event DefaultDelegate ontimer; 54 public event DefaultDelegate ontimer;
55 public event DefaultDelegate onlisten; 55 public event DefaultDelegate onlisten;
56 public event DefaultDelegate onon_rez; 56 public event DefaultDelegate onon_rez;
57 public event DefaultDelegate onsensor; 57 public event DefaultDelegate onsensor;
58 public event DefaultDelegate onno_sensor; 58 public event DefaultDelegate onno_sensor;
59 public event DefaultDelegate oncontrol; 59 public event DefaultDelegate oncontrol;
60 public event DefaultDelegate onmoney; 60 public event DefaultDelegate onmoney;
61 public event DefaultDelegate onemail; 61 public event DefaultDelegate onemail;
62 public event DefaultDelegate onat_target; 62 public event DefaultDelegate onat_target;
63 public event DefaultDelegate onnot_at_target; 63 public event DefaultDelegate onnot_at_target;
64 public event DefaultDelegate onat_rot_target; 64 public event DefaultDelegate onat_rot_target;
65 public event DefaultDelegate onnot_at_rot_target; 65 public event DefaultDelegate onnot_at_rot_target;
66 public event DefaultDelegate onrun_time_permissions; 66 public event DefaultDelegate onrun_time_permissions;
67 public event DefaultDelegate onchanged; 67 public event DefaultDelegate onchanged;
68 public event DefaultDelegate onattach; 68 public event DefaultDelegate onattach;
69 public event DefaultDelegate ondataserver; 69 public event DefaultDelegate ondataserver;
70 public event DefaultDelegate onlink_message; 70 public event DefaultDelegate onlink_message;
71 public event DefaultDelegate onmoving_start; 71 public event DefaultDelegate onmoving_start;
72 public event DefaultDelegate onmoving_end; 72 public event DefaultDelegate onmoving_end;
73 public event DefaultDelegate onobject_rez; 73 public event DefaultDelegate onobject_rez;
74 public event DefaultDelegate onremote_data; 74 public event DefaultDelegate onremote_data;
75 public event DefaultDelegate onhttp_response; 75 public event DefaultDelegate onhttp_response;
76 76
77 77
78 public void ScriptRez() { onScriptRez(); } 78 public void ScriptRez() { onScriptRez(); }
79 public void state_entry() { onstate_entry(); } 79 public void state_entry() { onstate_entry(); }
80 public void state_exit() { onstate_exit(); } 80 public void state_exit() { onstate_exit(); }
81 public void touch_start() { ontouch_start(); } 81 public void touch_start() { ontouch_start(); }
82 public void touch() { ontouch(); } 82 public void touch() { ontouch(); }
83 public void touch_end() { ontouch_end(); } 83 public void touch_end() { ontouch_end(); }
84 public void collision_start() { oncollision_start(); } 84 public void collision_start() { oncollision_start(); }
85 public void collision() { oncollision(); } 85 public void collision() { oncollision(); }
86 public void collision_end() { oncollision_end(); } 86 public void collision_end() { oncollision_end(); }
87 public void land_collision_start() { onland_collision_start(); } 87 public void land_collision_start() { onland_collision_start(); }
88 public void land_collision() { onland_collision(); } 88 public void land_collision() { onland_collision(); }
89 public void land_collision_end() { onland_collision_end(); } 89 public void land_collision_end() { onland_collision_end(); }
90 public void timer() { ontimer(); } 90 public void timer() { ontimer(); }
91 public void listen() { onlisten(); } 91 public void listen() { onlisten(); }
92 public void on_rez() { onon_rez(); } 92 public void on_rez() { onon_rez(); }
93 public void sensor() { onsensor(); } 93 public void sensor() { onsensor(); }
94 public void no_sensor() { onno_sensor(); } 94 public void no_sensor() { onno_sensor(); }
95 public void control() { oncontrol(); } 95 public void control() { oncontrol(); }
96 public void money() { onmoney(); } 96 public void money() { onmoney(); }
97 public void email() { onemail(); } 97 public void email() { onemail(); }
98 public void at_target() { onat_target(); } 98 public void at_target() { onat_target(); }
99 public void not_at_target() { onnot_at_target(); } 99 public void not_at_target() { onnot_at_target(); }
100 public void at_rot_target() { onat_rot_target(); } 100 public void at_rot_target() { onat_rot_target(); }
101 public void not_at_rot_target() { onnot_at_rot_target(); } 101 public void not_at_rot_target() { onnot_at_rot_target(); }
102 public void run_time_permissions() { onrun_time_permissions(); } 102 public void run_time_permissions() { onrun_time_permissions(); }
103 public void changed() { onchanged(); } 103 public void changed() { onchanged(); }
104 public void attach() { onattach(); } 104 public void attach() { onattach(); }
105 public void dataserver() { ondataserver(); } 105 public void dataserver() { ondataserver(); }
106 public void link_message() { onlink_message(); } 106 public void link_message() { onlink_message(); }
107 public void moving_start() { onmoving_start(); } 107 public void moving_start() { onmoving_start(); }
108 public void moving_end() { onmoving_end(); } 108 public void moving_end() { onmoving_end(); }
109 public void object_rez() { onobject_rez(); } 109 public void object_rez() { onobject_rez(); }
110 public void remote_data() { onremote_data(); } 110 public void remote_data() { onremote_data(); }
111 public void http_response() { onhttp_response(); } 111 public void http_response() { onhttp_response(); }
112 112
113 } 113 }
114} 114}
diff --git a/OpenSim/Grid/UserServer/UserLoginService.cs b/OpenSim/Grid/UserServer/UserLoginService.cs
index 10a8974..2aecfa2 100644
--- a/OpenSim/Grid/UserServer/UserLoginService.cs
+++ b/OpenSim/Grid/UserServer/UserLoginService.cs
@@ -56,7 +56,7 @@ namespace OpenSim.Grid.UserServer
56 /// <param name="theUser">The user profile</param> 56 /// <param name="theUser">The user profile</param>
57 public override void CustomiseResponse(LoginResponse response, UserProfileData theUser) 57 public override void CustomiseResponse(LoginResponse response, UserProfileData theUser)
58 { 58 {
59 // Load information from the gridserver 59 // Load information from the gridserver
60 RegionProfileData SimInfo = new RegionProfileData(); 60 RegionProfileData SimInfo = new RegionProfileData();
61 SimInfo = SimInfo.RequestSimProfileData(theUser.currentAgent.currentHandle, m_config.GridServerURL, m_config.GridSendKey, m_config.GridRecvKey); 61 SimInfo = SimInfo.RequestSimProfileData(theUser.currentAgent.currentHandle, m_config.GridServerURL, m_config.GridSendKey, m_config.GridRecvKey);
62 62
diff --git a/OpenSim/Region/Environment/Modules/AssetDownloadModule.cs b/OpenSim/Region/Environment/Modules/AssetDownloadModule.cs
index b53c05e..440d948 100644
--- a/OpenSim/Region/Environment/Modules/AssetDownloadModule.cs
+++ b/OpenSim/Region/Environment/Modules/AssetDownloadModule.cs
@@ -1,72 +1,72 @@
1/* 1/*
2* Copyright (c) Contributors, http://opensimulator.org/ 2* Copyright (c) Contributors, http://opensimulator.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28 28
29using OpenSim.Framework.Interfaces; 29using OpenSim.Framework.Interfaces;
30using OpenSim.Region.Environment.Interfaces; 30using OpenSim.Region.Environment.Interfaces;
31using OpenSim.Region.Environment.Scenes; 31using OpenSim.Region.Environment.Scenes;
32using Nini.Config; 32using Nini.Config;
33 33
34namespace OpenSim.Region.Environment.Modules 34namespace OpenSim.Region.Environment.Modules
35{ 35{
36 public class AssetDownloadModule : IRegionModule 36 public class AssetDownloadModule : IRegionModule
37 { 37 {
38 private Scene m_scene; 38 private Scene m_scene;
39 39
40 public AssetDownloadModule() 40 public AssetDownloadModule()
41 { 41 {
42 } 42 }
43 43
44 public void Initialise(Scene scene, IConfigSource config) 44 public void Initialise(Scene scene, IConfigSource config)
45 { 45 {
46 m_scene = scene; 46 m_scene = scene;
47 m_scene.EventManager.OnNewClient += NewClient; 47 m_scene.EventManager.OnNewClient += NewClient;
48 } 48 }
49 49
50 public void PostInitialise() 50 public void PostInitialise()
51 { 51 {
52 } 52 }
53 53
54 public void Close() 54 public void Close()
55 { 55 {
56 } 56 }
57 57
58 public string Name 58 public string Name
59 { 59 {
60 get { return "AssetDownloadModule"; } 60 get { return "AssetDownloadModule"; }
61 } 61 }
62 62
63 public bool IsSharedModule 63 public bool IsSharedModule
64 { 64 {
65 get { return false; } 65 get { return false; }
66 } 66 }
67 67
68 public void NewClient(IClientAPI client) 68 public void NewClient(IClientAPI client)
69 { 69 {
70 } 70 }
71 } 71 }
72} 72}
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
index ff58fd8..96beb05 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
@@ -1,476 +1,476 @@
1/* 1/*
2* Copyright (c) Contributors, http://opensimulator.org/ 2* Copyright (c) Contributors, http://opensimulator.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28 28
29using Axiom.Math; 29using Axiom.Math;
30using libsecondlife; 30using libsecondlife;
31using libsecondlife.Packets; 31using libsecondlife.Packets;
32using OpenSim.Framework.Communications.Cache; 32using OpenSim.Framework.Communications.Cache;
33using OpenSim.Framework.Communications.Caches; 33using OpenSim.Framework.Communications.Caches;
34using OpenSim.Framework.Interfaces; 34using OpenSim.Framework.Interfaces;
35using OpenSim.Framework.Types; 35using OpenSim.Framework.Types;
36using OpenSim.Framework.Utilities; 36using OpenSim.Framework.Utilities;
37using OpenSim.Region.Physics.Manager; 37using OpenSim.Region.Physics.Manager;
38 38
39namespace OpenSim.Region.Environment.Scenes 39namespace OpenSim.Region.Environment.Scenes
40{ 40{
41 public partial class Scene 41 public partial class Scene
42 { 42 {
43 //split these method into this partial as a lot of these (hopefully) are only temporary and won't be needed once Caps is more complete 43 //split these method into this partial as a lot of these (hopefully) are only temporary and won't be needed once Caps is more complete
44 // or at least some of they can be moved somewhere else 44 // or at least some of they can be moved somewhere else
45 45
46 public void AddInventoryItem(LLUUID avatarId, InventoryItemBase item) 46 public void AddInventoryItem(LLUUID avatarId, InventoryItemBase item)
47 { 47 {
48 ScenePresence avatar; 48 ScenePresence avatar;
49 49
50 if ( TryGetAvatar( avatarId, out avatar )) 50 if ( TryGetAvatar( avatarId, out avatar ))
51 { 51 {
52 AddInventoryItem(avatar.ControllingClient, item); 52 AddInventoryItem(avatar.ControllingClient, item);
53 } 53 }
54 } 54 }
55 55
56 public void AddInventoryItem(IClientAPI remoteClient, InventoryItemBase item) 56 public void AddInventoryItem(IClientAPI remoteClient, InventoryItemBase item)
57 { 57 {
58 CachedUserInfo userInfo = commsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId); 58 CachedUserInfo userInfo = commsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId);
59 if (userInfo != null) 59 if (userInfo != null)
60 { 60 {
61 userInfo.AddItem(remoteClient.AgentId, item); 61 userInfo.AddItem(remoteClient.AgentId, item);
62 remoteClient.SendInventoryItemUpdate(item); 62 remoteClient.SendInventoryItemUpdate(item);
63 } 63 }
64 } 64 }
65 65
66 public LLUUID CapsUpdateInventoryItemAsset(LLUUID avatarId, LLUUID itemID, byte[] data) 66 public LLUUID CapsUpdateInventoryItemAsset(LLUUID avatarId, LLUUID itemID, byte[] data)
67 { 67 {
68 ScenePresence avatar; 68 ScenePresence avatar;
69 69
70 if (TryGetAvatar(avatarId, out avatar)) 70 if (TryGetAvatar(avatarId, out avatar))
71 { 71 {
72 return CapsUpdateInventoryItemAsset(avatar.ControllingClient, itemID, data); 72 return CapsUpdateInventoryItemAsset(avatar.ControllingClient, itemID, data);
73 } 73 }
74 74
75 return LLUUID.Zero; 75 return LLUUID.Zero;
76 } 76 }
77 77
78 public LLUUID CapsUpdateInventoryItemAsset(IClientAPI remoteClient, LLUUID itemID, byte[] data) 78 public LLUUID CapsUpdateInventoryItemAsset(IClientAPI remoteClient, LLUUID itemID, byte[] data)
79 { 79 {
80 CachedUserInfo userInfo = commsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId); 80 CachedUserInfo userInfo = commsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId);
81 if (userInfo != null) 81 if (userInfo != null)
82 { 82 {
83 if (userInfo.RootFolder != null) 83 if (userInfo.RootFolder != null)
84 { 84 {
85 InventoryItemBase item = userInfo.RootFolder.HasItem(itemID); 85 InventoryItemBase item = userInfo.RootFolder.HasItem(itemID);
86 if (item != null) 86 if (item != null)
87 { 87 {
88 AssetBase asset; 88 AssetBase asset;
89 asset = new AssetBase(); 89 asset = new AssetBase();
90 asset.FullID = LLUUID.Random(); 90 asset.FullID = LLUUID.Random();
91 asset.Type = (sbyte) item.assetType; 91 asset.Type = (sbyte) item.assetType;
92 asset.InvType = (sbyte) item.invType; 92 asset.InvType = (sbyte) item.invType;
93 asset.Name = item.inventoryName; 93 asset.Name = item.inventoryName;
94 asset.Data = data; 94 asset.Data = data;
95 commsManager.AssetCache.AddAsset(asset); 95 commsManager.AssetCache.AddAsset(asset);
96 96
97 item.assetID = asset.FullID; 97 item.assetID = asset.FullID;
98 userInfo.UpdateItem(remoteClient.AgentId, item); 98 userInfo.UpdateItem(remoteClient.AgentId, item);
99 99
100 // remoteClient.SendInventoryItemUpdate(item); 100 // remoteClient.SendInventoryItemUpdate(item);
101 if (item.invType == 7) 101 if (item.invType == 7)
102 { 102 {
103 //do we want to know about updated note cards? 103 //do we want to know about updated note cards?
104 } 104 }
105 else if (item.invType == 10) 105 else if (item.invType == 10)
106 { 106 {
107 // do we want to know about updated scripts 107 // do we want to know about updated scripts
108 } 108 }
109 109
110 return (asset.FullID); 110 return (asset.FullID);
111 } 111 }
112 } 112 }
113 } 113 }
114 return LLUUID.Zero; 114 return LLUUID.Zero;
115 } 115 }
116 116
117 public void UDPUpdateInventoryItemAsset(IClientAPI remoteClient, LLUUID transactionID, LLUUID assetID, 117 public void UDPUpdateInventoryItemAsset(IClientAPI remoteClient, LLUUID transactionID, LLUUID assetID,
118 LLUUID itemID) 118 LLUUID itemID)
119 { 119 {
120 CachedUserInfo userInfo = commsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId); 120 CachedUserInfo userInfo = commsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId);
121 if (userInfo != null) 121 if (userInfo != null)
122 { 122 {
123 if (userInfo.RootFolder != null) 123 if (userInfo.RootFolder != null)
124 { 124 {
125 InventoryItemBase item = userInfo.RootFolder.HasItem(itemID); 125 InventoryItemBase item = userInfo.RootFolder.HasItem(itemID);
126 if (item != null) 126 if (item != null)
127 { 127 {
128 AgentAssetTransactions transactions = 128 AgentAssetTransactions transactions =
129 commsManager.TransactionsManager.GetUserTransActions(remoteClient.AgentId); 129 commsManager.TransactionsManager.GetUserTransActions(remoteClient.AgentId);
130 if (transactions != null) 130 if (transactions != null)
131 { 131 {
132 AssetBase asset = null; 132 AssetBase asset = null;
133 bool addToCache = false; 133 bool addToCache = false;
134 134
135 asset = commsManager.AssetCache.GetAsset(assetID); 135 asset = commsManager.AssetCache.GetAsset(assetID);
136 if (asset == null) 136 if (asset == null)
137 { 137 {
138 asset = transactions.GetTransactionAsset(transactionID); 138 asset = transactions.GetTransactionAsset(transactionID);
139 addToCache = true; 139 addToCache = true;
140 } 140 }
141 141
142 if (asset != null) 142 if (asset != null)
143 { 143 {
144 if (asset.FullID == assetID) 144 if (asset.FullID == assetID)
145 { 145 {
146 asset.Name = item.inventoryName; 146 asset.Name = item.inventoryName;
147 asset.Description = item.inventoryDescription; 147 asset.Description = item.inventoryDescription;
148 asset.InvType = (sbyte) item.invType; 148 asset.InvType = (sbyte) item.invType;
149 asset.Type = (sbyte) item.assetType; 149 asset.Type = (sbyte) item.assetType;
150 item.assetID = asset.FullID; 150 item.assetID = asset.FullID;
151 151
152 if (addToCache) 152 if (addToCache)
153 { 153 {
154 commsManager.AssetCache.AddAsset(asset); 154 commsManager.AssetCache.AddAsset(asset);
155 } 155 }
156 156
157 userInfo.UpdateItem(remoteClient.AgentId, item); 157 userInfo.UpdateItem(remoteClient.AgentId, item);
158 } 158 }
159 } 159 }
160 } 160 }
161 } 161 }
162 } 162 }
163 } 163 }
164 } 164 }
165 165
166 /// <summary> 166 /// <summary>
167 /// temporary method to test out creating new inventory items 167 /// temporary method to test out creating new inventory items
168 /// </summary> 168 /// </summary>
169 /// <param name="remoteClient"></param> 169 /// <param name="remoteClient"></param>
170 /// <param name="transActionID"></param> 170 /// <param name="transActionID"></param>
171 /// <param name="folderID"></param> 171 /// <param name="folderID"></param>
172 /// <param name="callbackID"></param> 172 /// <param name="callbackID"></param>
173 /// <param name="description"></param> 173 /// <param name="description"></param>
174 /// <param name="name"></param> 174 /// <param name="name"></param>
175 /// <param name="invType"></param> 175 /// <param name="invType"></param>
176 /// <param name="type"></param> 176 /// <param name="type"></param>
177 /// <param name="wearableType"></param> 177 /// <param name="wearableType"></param>
178 /// <param name="nextOwnerMask"></param> 178 /// <param name="nextOwnerMask"></param>
179 public void CreateNewInventoryItem(IClientAPI remoteClient, LLUUID transActionID, LLUUID folderID, 179 public void CreateNewInventoryItem(IClientAPI remoteClient, LLUUID transActionID, LLUUID folderID,
180 uint callbackID, string description, string name, sbyte invType, sbyte type, 180 uint callbackID, string description, string name, sbyte invType, sbyte type,
181 byte wearableType, uint nextOwnerMask) 181 byte wearableType, uint nextOwnerMask)
182 { 182 {
183 if (transActionID == LLUUID.Zero) 183 if (transActionID == LLUUID.Zero)
184 { 184 {
185 CachedUserInfo userInfo = commsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId); 185 CachedUserInfo userInfo = commsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId);
186 if (userInfo != null) 186 if (userInfo != null)
187 { 187 {
188 AssetBase asset = new AssetBase(); 188 AssetBase asset = new AssetBase();
189 asset.Name = name; 189 asset.Name = name;
190 asset.Description = description; 190 asset.Description = description;
191 asset.InvType = invType; 191 asset.InvType = invType;
192 asset.Type = type; 192 asset.Type = type;
193 asset.FullID = LLUUID.Random(); 193 asset.FullID = LLUUID.Random();
194 asset.Data = new byte[1]; 194 asset.Data = new byte[1];
195 commsManager.AssetCache.AddAsset(asset); 195 commsManager.AssetCache.AddAsset(asset);
196 196
197 InventoryItemBase item = new InventoryItemBase(); 197 InventoryItemBase item = new InventoryItemBase();
198 item.avatarID = remoteClient.AgentId; 198 item.avatarID = remoteClient.AgentId;
199 item.creatorsID = remoteClient.AgentId; 199 item.creatorsID = remoteClient.AgentId;
200 item.inventoryID = LLUUID.Random(); 200 item.inventoryID = LLUUID.Random();
201 item.assetID = asset.FullID; 201 item.assetID = asset.FullID;
202 item.inventoryDescription = description; 202 item.inventoryDescription = description;
203 item.inventoryName = name; 203 item.inventoryName = name;
204 item.assetType = invType; 204 item.assetType = invType;
205 item.invType = invType; 205 item.invType = invType;
206 item.parentFolderID = folderID; 206 item.parentFolderID = folderID;
207 item.inventoryCurrentPermissions = 2147483647; 207 item.inventoryCurrentPermissions = 2147483647;
208 item.inventoryNextPermissions = nextOwnerMask; 208 item.inventoryNextPermissions = nextOwnerMask;
209 209
210 userInfo.AddItem(remoteClient.AgentId, item); 210 userInfo.AddItem(remoteClient.AgentId, item);
211 remoteClient.SendInventoryItemUpdate(item); 211 remoteClient.SendInventoryItemUpdate(item);
212 } 212 }
213 } 213 }
214 else 214 else
215 { 215 {
216 commsManager.TransactionsManager.HandleInventoryFromTransaction(remoteClient, transActionID, folderID, 216 commsManager.TransactionsManager.HandleInventoryFromTransaction(remoteClient, transActionID, folderID,
217 callbackID, description, name, invType, 217 callbackID, description, name, invType,
218 type, wearableType, nextOwnerMask); 218 type, wearableType, nextOwnerMask);
219 //System.Console.WriteLine("request to create inventory item from transaction " + transActionID); 219 //System.Console.WriteLine("request to create inventory item from transaction " + transActionID);
220 } 220 }
221 } 221 }
222 222
223 /// <summary> 223 /// <summary>
224 /// 224 ///
225 /// </summary> 225 /// </summary>
226 /// <param name="remoteClient"></param> 226 /// <param name="remoteClient"></param>
227 /// <param name="primLocalID"></param> 227 /// <param name="primLocalID"></param>
228 public void RequestTaskInventory(IClientAPI remoteClient, uint primLocalID) 228 public void RequestTaskInventory(IClientAPI remoteClient, uint primLocalID)
229 { 229 {
230 bool hasPrim = false; 230 bool hasPrim = false;
231 foreach (EntityBase ent in Entities.Values) 231 foreach (EntityBase ent in Entities.Values)
232 { 232 {
233 if (ent is SceneObjectGroup) 233 if (ent is SceneObjectGroup)
234 { 234 {
235 hasPrim = ((SceneObjectGroup) ent).HasChildPrim(primLocalID); 235 hasPrim = ((SceneObjectGroup) ent).HasChildPrim(primLocalID);
236 if (hasPrim != false) 236 if (hasPrim != false)
237 { 237 {
238 bool fileChange = ((SceneObjectGroup) ent).GetPartInventoryFileName(remoteClient, primLocalID); 238 bool fileChange = ((SceneObjectGroup) ent).GetPartInventoryFileName(remoteClient, primLocalID);
239 if (fileChange) 239 if (fileChange)
240 { 240 {
241 if (XferManager != null) 241 if (XferManager != null)
242 { 242 {
243 ((SceneObjectGroup) ent).RequestInventoryFile(primLocalID, XferManager); 243 ((SceneObjectGroup) ent).RequestInventoryFile(primLocalID, XferManager);
244 } 244 }
245 } 245 }
246 break; 246 break;
247 } 247 }
248 } 248 }
249 } 249 }
250 } 250 }
251 251
252 public void RemoveTaskInventory(IClientAPI remoteClient, LLUUID itemID, uint localID) 252 public void RemoveTaskInventory(IClientAPI remoteClient, LLUUID itemID, uint localID)
253 { 253 {
254 bool hasPrim = false; 254 bool hasPrim = false;
255 foreach (EntityBase ent in Entities.Values) 255 foreach (EntityBase ent in Entities.Values)
256 { 256 {
257 if (ent is SceneObjectGroup) 257 if (ent is SceneObjectGroup)
258 { 258 {
259 hasPrim = ((SceneObjectGroup) ent).HasChildPrim(localID); 259 hasPrim = ((SceneObjectGroup) ent).HasChildPrim(localID);
260 if (hasPrim != false) 260 if (hasPrim != false)
261 { 261 {
262 int type = ((SceneObjectGroup) ent).RemoveInventoryItem(remoteClient, localID, itemID); 262 int type = ((SceneObjectGroup) ent).RemoveInventoryItem(remoteClient, localID, itemID);
263 ((SceneObjectGroup) ent).GetProperites(remoteClient); 263 ((SceneObjectGroup) ent).GetProperites(remoteClient);
264 if (type == 10) 264 if (type == 10)
265 { 265 {
266 EventManager.TriggerRemoveScript(localID, itemID); 266 EventManager.TriggerRemoveScript(localID, itemID);
267 } 267 }
268 } 268 }
269 } 269 }
270 } 270 }
271 } 271 }
272 272
273 public void RezScript(IClientAPI remoteClient, LLUUID itemID, uint localID) 273 public void RezScript(IClientAPI remoteClient, LLUUID itemID, uint localID)
274 { 274 {
275 CachedUserInfo userInfo = commsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId); 275 CachedUserInfo userInfo = commsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId);
276 LLUUID copyID = LLUUID.Random(); 276 LLUUID copyID = LLUUID.Random();
277 if (userInfo != null) 277 if (userInfo != null)
278 { 278 {
279 if (userInfo.RootFolder != null) 279 if (userInfo.RootFolder != null)
280 { 280 {
281 InventoryItemBase item = userInfo.RootFolder.HasItem(itemID); 281 InventoryItemBase item = userInfo.RootFolder.HasItem(itemID);
282 if (item != null) 282 if (item != null)
283 { 283 {
284 bool isTexture = false; 284 bool isTexture = false;
285 bool rezzed = false; 285 bool rezzed = false;
286 if (item.invType == 0) 286 if (item.invType == 0)
287 { 287 {
288 isTexture = true; 288 isTexture = true;
289 } 289 }
290 AssetBase rezAsset = commsManager.AssetCache.GetAsset(item.assetID, isTexture); 290 AssetBase rezAsset = commsManager.AssetCache.GetAsset(item.assetID, isTexture);
291 if (rezAsset != null) 291 if (rezAsset != null)
292 { 292 {
293 string script = Util.FieldToString(rezAsset.Data); 293 string script = Util.FieldToString(rezAsset.Data);
294 //Console.WriteLine("rez script "+script); 294 //Console.WriteLine("rez script "+script);
295 EventManager.TriggerRezScript(localID, copyID, script); 295 EventManager.TriggerRezScript(localID, copyID, script);
296 rezzed = true; 296 rezzed = true;
297 } 297 }
298 else 298 else
299 { 299 {
300 //lets try once more incase the asset cache is being slow getting the asset from server 300 //lets try once more incase the asset cache is being slow getting the asset from server
301 rezAsset = commsManager.AssetCache.GetAsset(item.assetID, isTexture); 301 rezAsset = commsManager.AssetCache.GetAsset(item.assetID, isTexture);
302 if (rezAsset != null) 302 if (rezAsset != null)
303 { 303 {
304 string script = Util.FieldToString(rezAsset.Data); 304 string script = Util.FieldToString(rezAsset.Data);
305 // Console.WriteLine("rez script " + script); 305 // Console.WriteLine("rez script " + script);
306 EventManager.TriggerRezScript(localID, copyID, script); 306 EventManager.TriggerRezScript(localID, copyID, script);
307 rezzed = true; 307 rezzed = true;
308 } 308 }
309 } 309 }
310 310
311 if (rezzed) 311 if (rezzed)
312 { 312 {
313 bool hasPrim = false; 313 bool hasPrim = false;
314 foreach (EntityBase ent in Entities.Values) 314 foreach (EntityBase ent in Entities.Values)
315 { 315 {
316 if (ent is SceneObjectGroup) 316 if (ent is SceneObjectGroup)
317 { 317 {
318 hasPrim = ((SceneObjectGroup) ent).HasChildPrim(localID); 318 hasPrim = ((SceneObjectGroup) ent).HasChildPrim(localID);
319 if (hasPrim != false) 319 if (hasPrim != false)
320 { 320 {
321 bool added = 321 bool added =
322 ((SceneObjectGroup) ent).AddInventoryItem(remoteClient, localID, item, 322 ((SceneObjectGroup) ent).AddInventoryItem(remoteClient, localID, item,
323 copyID); 323 copyID);
324 ((SceneObjectGroup) ent).GetProperites(remoteClient); 324 ((SceneObjectGroup) ent).GetProperites(remoteClient);
325 } 325 }
326 } 326 }
327 } 327 }
328 } 328 }
329 } 329 }
330 } 330 }
331 } 331 }
332 } 332 }
333 333
334 /// <summary> 334 /// <summary>
335 /// 335 ///
336 /// </summary> 336 /// </summary>
337 /// <param name="packet"></param> 337 /// <param name="packet"></param>
338 /// <param name="simClient"></param> 338 /// <param name="simClient"></param>
339 public void DeRezObject(Packet packet, IClientAPI remoteClient) 339 public void DeRezObject(Packet packet, IClientAPI remoteClient)
340 { 340 {
341 DeRezObjectPacket DeRezPacket = (DeRezObjectPacket) packet; 341 DeRezObjectPacket DeRezPacket = (DeRezObjectPacket) packet;
342 342
343 if (DeRezPacket.AgentBlock.DestinationID == LLUUID.Zero) 343 if (DeRezPacket.AgentBlock.DestinationID == LLUUID.Zero)
344 { 344 {
345 //currently following code not used (or don't know of any case of destination being zero 345 //currently following code not used (or don't know of any case of destination being zero
346 } 346 }
347 else 347 else
348 { 348 {
349 foreach (DeRezObjectPacket.ObjectDataBlock Data in DeRezPacket.ObjectData) 349 foreach (DeRezObjectPacket.ObjectDataBlock Data in DeRezPacket.ObjectData)
350 { 350 {
351 EntityBase selectedEnt = null; 351 EntityBase selectedEnt = null;
352 //OpenSim.Framework.Console.MainConsole.Instance.WriteLine("LocalID:" + Data.ObjectLocalID.ToString()); 352 //OpenSim.Framework.Console.MainConsole.Instance.WriteLine("LocalID:" + Data.ObjectLocalID.ToString());
353 foreach (EntityBase ent in Entities.Values) 353 foreach (EntityBase ent in Entities.Values)
354 { 354 {
355 if (ent.LocalId == Data.ObjectLocalID) 355 if (ent.LocalId == Data.ObjectLocalID)
356 { 356 {
357 selectedEnt = ent; 357 selectedEnt = ent;
358 break; 358 break;
359 } 359 }
360 } 360 }
361 if (selectedEnt != null) 361 if (selectedEnt != null)
362 { 362 {
363 if (PermissionsMngr.CanDeRezObject(remoteClient.AgentId, ((SceneObjectGroup) selectedEnt).UUID)) 363 if (PermissionsMngr.CanDeRezObject(remoteClient.AgentId, ((SceneObjectGroup) selectedEnt).UUID))
364 { 364 {
365 string sceneObjectXml = ((SceneObjectGroup) selectedEnt).ToXmlString(); 365 string sceneObjectXml = ((SceneObjectGroup) selectedEnt).ToXmlString();
366 CachedUserInfo userInfo = commsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId); 366 CachedUserInfo userInfo = commsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId);
367 if (userInfo != null) 367 if (userInfo != null)
368 { 368 {
369 AssetBase asset = new AssetBase(); 369 AssetBase asset = new AssetBase();
370 asset.Name = ((SceneObjectGroup) selectedEnt).GetPartName(selectedEnt.LocalId); 370 asset.Name = ((SceneObjectGroup) selectedEnt).GetPartName(selectedEnt.LocalId);
371 asset.Description = 371 asset.Description =
372 ((SceneObjectGroup) selectedEnt).GetPartDescription(selectedEnt.LocalId); 372 ((SceneObjectGroup) selectedEnt).GetPartDescription(selectedEnt.LocalId);
373 asset.InvType = 6; 373 asset.InvType = 6;
374 asset.Type = 6; 374 asset.Type = 6;
375 asset.FullID = LLUUID.Random(); 375 asset.FullID = LLUUID.Random();
376 asset.Data = Helpers.StringToField(sceneObjectXml); 376 asset.Data = Helpers.StringToField(sceneObjectXml);
377 commsManager.AssetCache.AddAsset(asset); 377 commsManager.AssetCache.AddAsset(asset);
378 378
379 379
380 InventoryItemBase item = new InventoryItemBase(); 380 InventoryItemBase item = new InventoryItemBase();
381 item.avatarID = remoteClient.AgentId; 381 item.avatarID = remoteClient.AgentId;
382 item.creatorsID = remoteClient.AgentId; 382 item.creatorsID = remoteClient.AgentId;
383 item.inventoryID = LLUUID.Random(); 383 item.inventoryID = LLUUID.Random();
384 item.assetID = asset.FullID; 384 item.assetID = asset.FullID;
385 item.inventoryDescription = asset.Description; 385 item.inventoryDescription = asset.Description;
386 item.inventoryName = asset.Name; 386 item.inventoryName = asset.Name;
387 item.assetType = asset.Type; 387 item.assetType = asset.Type;
388 item.invType = asset.InvType; 388 item.invType = asset.InvType;
389 item.parentFolderID = DeRezPacket.AgentBlock.DestinationID; 389 item.parentFolderID = DeRezPacket.AgentBlock.DestinationID;
390 item.inventoryCurrentPermissions = 2147483647; 390 item.inventoryCurrentPermissions = 2147483647;
391 item.inventoryNextPermissions = 2147483647; 391 item.inventoryNextPermissions = 2147483647;
392 392
393 userInfo.AddItem(remoteClient.AgentId, item); 393 userInfo.AddItem(remoteClient.AgentId, item);
394 remoteClient.SendInventoryItemUpdate(item); 394 remoteClient.SendInventoryItemUpdate(item);
395 } 395 }
396 396
397 DeleteSceneObjectGroup((SceneObjectGroup)selectedEnt); 397 DeleteSceneObjectGroup((SceneObjectGroup)selectedEnt);
398 } 398 }
399 } 399 }
400 } 400 }
401 } 401 }
402 } 402 }
403 403
404 public void DeleteSceneObjectGroup(SceneObjectGroup group) 404 public void DeleteSceneObjectGroup(SceneObjectGroup group)
405 { 405 {
406 SceneObjectPart rootPart = (group).GetChildPart(group.UUID); 406 SceneObjectPart rootPart = (group).GetChildPart(group.UUID);
407 if (rootPart.PhysActor != null) 407 if (rootPart.PhysActor != null)
408 { 408 {
409 phyScene.RemovePrim(rootPart.PhysActor); 409 phyScene.RemovePrim(rootPart.PhysActor);
410 rootPart.PhysActor = null; 410 rootPart.PhysActor = null;
411 } 411 }
412 412
413 storageManager.DataStore.RemoveObject(group.UUID, m_regInfo.RegionID); 413 storageManager.DataStore.RemoveObject(group.UUID, m_regInfo.RegionID);
414 group.DeleteGroup(); 414 group.DeleteGroup();
415 415
416 lock (Entities) 416 lock (Entities)
417 { 417 {
418 Entities.Remove(group.UUID); 418 Entities.Remove(group.UUID);
419 } 419 }
420 group.DeleteParts(); 420 group.DeleteParts();
421 } 421 }
422 422
423 public void RezObject(IClientAPI remoteClient, LLUUID itemID, LLVector3 pos) 423 public void RezObject(IClientAPI remoteClient, LLUUID itemID, LLVector3 pos)
424 { 424 {
425 CachedUserInfo userInfo = commsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId); 425 CachedUserInfo userInfo = commsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId);
426 if (userInfo != null) 426 if (userInfo != null)
427 { 427 {
428 if (userInfo.RootFolder != null) 428 if (userInfo.RootFolder != null)
429 { 429 {
430 InventoryItemBase item = userInfo.RootFolder.HasItem(itemID); 430 InventoryItemBase item = userInfo.RootFolder.HasItem(itemID);
431 if (item != null) 431 if (item != null)
432 { 432 {
433 AssetBase rezAsset = commsManager.AssetCache.GetAsset(item.assetID, false); 433 AssetBase rezAsset = commsManager.AssetCache.GetAsset(item.assetID, false);
434 if (rezAsset != null) 434 if (rezAsset != null)
435 { 435 {
436 AddRezObject(Util.FieldToString(rezAsset.Data), pos); 436 AddRezObject(Util.FieldToString(rezAsset.Data), pos);
437 userInfo.DeleteItem(remoteClient.AgentId, item); 437 userInfo.DeleteItem(remoteClient.AgentId, item);
438 remoteClient.SendRemoveInventoryItem(itemID); 438 remoteClient.SendRemoveInventoryItem(itemID);
439 } 439 }
440 else 440 else
441 { 441 {
442 //lets try once more incase the asset cache is being slow getting the asset from server 442 //lets try once more incase the asset cache is being slow getting the asset from server
443 rezAsset = commsManager.AssetCache.GetAsset(item.assetID, false); 443 rezAsset = commsManager.AssetCache.GetAsset(item.assetID, false);
444 if (rezAsset != null) 444 if (rezAsset != null)
445 { 445 {
446 AddRezObject(Util.FieldToString(rezAsset.Data), pos); 446 AddRezObject(Util.FieldToString(rezAsset.Data), pos);
447 userInfo.DeleteItem(remoteClient.AgentId, item); 447 userInfo.DeleteItem(remoteClient.AgentId, item);
448 remoteClient.SendRemoveInventoryItem(itemID); 448 remoteClient.SendRemoveInventoryItem(itemID);
449 } 449 }
450 } 450 }
451 } 451 }
452 } 452 }
453 } 453 }
454 } 454 }
455 455
456 private void AddRezObject(string xmlData, LLVector3 pos) 456 private void AddRezObject(string xmlData, LLVector3 pos)
457 { 457 {
458 SceneObjectGroup group = new SceneObjectGroup(this, m_regionHandle, xmlData); 458 SceneObjectGroup group = new SceneObjectGroup(this, m_regionHandle, xmlData);
459 AddEntity(group); 459 AddEntity(group);
460 group.AbsolutePosition = pos; 460 group.AbsolutePosition = pos;
461 SceneObjectPart rootPart = group.GetChildPart(group.UUID); 461 SceneObjectPart rootPart = group.GetChildPart(group.UUID);
462 if ((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Phantom) == 0) 462 if ((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Phantom) == 0)
463 { 463 {
464 PrimitiveBaseShape pbs = rootPart.Shape; 464 PrimitiveBaseShape pbs = rootPart.Shape;
465 rootPart.PhysActor = phyScene.AddPrimShape( 465 rootPart.PhysActor = phyScene.AddPrimShape(
466 rootPart.Name, 466 rootPart.Name,
467 pbs, 467 pbs,
468 new PhysicsVector(rootPart.AbsolutePosition.X, rootPart.AbsolutePosition.Y, 468 new PhysicsVector(rootPart.AbsolutePosition.X, rootPart.AbsolutePosition.Y,
469 rootPart.AbsolutePosition.Z), 469 rootPart.AbsolutePosition.Z),
470 new PhysicsVector(rootPart.Scale.X, rootPart.Scale.Y, rootPart.Scale.Z), 470 new PhysicsVector(rootPart.Scale.X, rootPart.Scale.Y, rootPart.Scale.Z),
471 new Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X, 471 new Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X,
472 rootPart.RotationOffset.Y, rootPart.RotationOffset.Z)); 472 rootPart.RotationOffset.Y, rootPart.RotationOffset.Z));
473 } 473 }
474 } 474 }
475 } 475 }
476} 476}
diff --git a/OpenSim/Region/Environment/Types/BasicQuadTreeNode.cs b/OpenSim/Region/Environment/Types/BasicQuadTreeNode.cs
index 20bb51d..942ec4d 100644
--- a/OpenSim/Region/Environment/Types/BasicQuadTreeNode.cs
+++ b/OpenSim/Region/Environment/Types/BasicQuadTreeNode.cs
@@ -1,258 +1,258 @@
1/* 1/*
2* Copyright (c) Contributors, http://opensimulator.org/ 2* Copyright (c) Contributors, http://opensimulator.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28 28
29using System.Collections.Generic; 29using System.Collections.Generic;
30using OpenSim.Region.Environment.Scenes; 30using OpenSim.Region.Environment.Scenes;
31 31
32namespace OpenSim.Region.Environment.Types 32namespace OpenSim.Region.Environment.Types
33{ 33{
34 public class BasicQuadTreeNode 34 public class BasicQuadTreeNode
35 { 35 {
36 private List<SceneObjectGroup> m_objects = new List<SceneObjectGroup>(); 36 private List<SceneObjectGroup> m_objects = new List<SceneObjectGroup>();
37 private BasicQuadTreeNode[] m_childNodes = null; 37 private BasicQuadTreeNode[] m_childNodes = null;
38 private BasicQuadTreeNode m_parent = null; 38 private BasicQuadTreeNode m_parent = null;
39 39
40 private short m_leftX; 40 private short m_leftX;
41 private short m_leftY; 41 private short m_leftY;
42 private short m_width; 42 private short m_width;
43 private short m_height; 43 private short m_height;
44 //private int m_quadNumber; 44 //private int m_quadNumber;
45 private string m_quadID; 45 private string m_quadID;
46 46
47 public BasicQuadTreeNode(BasicQuadTreeNode parent, string quadID, short leftX, short leftY, short width, short height) 47 public BasicQuadTreeNode(BasicQuadTreeNode parent, string quadID, short leftX, short leftY, short width, short height)
48 { 48 {
49 m_parent = parent; 49 m_parent = parent;
50 m_quadID = quadID; 50 m_quadID = quadID;
51 m_leftX = leftX; 51 m_leftX = leftX;
52 m_leftY = leftY; 52 m_leftY = leftY;
53 m_width = width; 53 m_width = width;
54 m_height = height; 54 m_height = height;
55 // Console.WriteLine("creating quadtree node " + m_quadID); 55 // Console.WriteLine("creating quadtree node " + m_quadID);
56 } 56 }
57 57
58 public void AddObject(SceneObjectGroup obj) 58 public void AddObject(SceneObjectGroup obj)
59 { 59 {
60 if (m_childNodes == null) 60 if (m_childNodes == null)
61 { 61 {
62 if (!m_objects.Contains(obj)) 62 if (!m_objects.Contains(obj))
63 { 63 {
64 m_objects.Add(obj); 64 m_objects.Add(obj);
65 } 65 }
66 } 66 }
67 else 67 else
68 { 68 {
69 if (obj.AbsolutePosition.X < (m_leftX + (m_width / 2))) 69 if (obj.AbsolutePosition.X < (m_leftX + (m_width / 2)))
70 { 70 {
71 if (obj.AbsolutePosition.Y < (m_leftY + (m_height / 2))) 71 if (obj.AbsolutePosition.Y < (m_leftY + (m_height / 2)))
72 { 72 {
73 m_childNodes[0].AddObject(obj); 73 m_childNodes[0].AddObject(obj);
74 } 74 }
75 else 75 else
76 { 76 {
77 m_childNodes[2].AddObject(obj); 77 m_childNodes[2].AddObject(obj);
78 } 78 }
79 } 79 }
80 else 80 else
81 { 81 {
82 if (obj.AbsolutePosition.Y < (m_leftY + (m_height / 2))) 82 if (obj.AbsolutePosition.Y < (m_leftY + (m_height / 2)))
83 { 83 {
84 m_childNodes[1].AddObject(obj); 84 m_childNodes[1].AddObject(obj);
85 } 85 }
86 else 86 else
87 { 87 {
88 m_childNodes[3].AddObject(obj); 88 m_childNodes[3].AddObject(obj);
89 } 89 }
90 } 90 }
91 } 91 }
92 } 92 }
93 93
94 public void Subdivide() 94 public void Subdivide()
95 { 95 {
96 if (m_childNodes == null) 96 if (m_childNodes == null)
97 { 97 {
98 m_childNodes = new BasicQuadTreeNode[4]; 98 m_childNodes = new BasicQuadTreeNode[4];
99 m_childNodes[0] = new BasicQuadTreeNode(this, m_quadID + "1/", m_leftX, m_leftY, (short)(m_width / 2), (short)(m_height / 2)); 99 m_childNodes[0] = new BasicQuadTreeNode(this, m_quadID + "1/", m_leftX, m_leftY, (short)(m_width / 2), (short)(m_height / 2));
100 m_childNodes[1] = new BasicQuadTreeNode(this, m_quadID + "2/", (short)(m_leftX + (m_width / 2)), m_leftY, (short)(m_width / 2), (short)(m_height / 2)); 100 m_childNodes[1] = new BasicQuadTreeNode(this, m_quadID + "2/", (short)(m_leftX + (m_width / 2)), m_leftY, (short)(m_width / 2), (short)(m_height / 2));
101 m_childNodes[2] = new BasicQuadTreeNode(this, m_quadID + "3/", m_leftX, (short)(m_leftY + (m_height / 2)), (short)(m_width / 2), (short)(m_height / 2)); 101 m_childNodes[2] = new BasicQuadTreeNode(this, m_quadID + "3/", m_leftX, (short)(m_leftY + (m_height / 2)), (short)(m_width / 2), (short)(m_height / 2));
102 m_childNodes[3] = new BasicQuadTreeNode(this, m_quadID + "4/", (short)(m_leftX + (m_width / 2)), (short)(m_height + (m_height / 2)), (short)(m_width / 2), (short)(m_height / 2)); 102 m_childNodes[3] = new BasicQuadTreeNode(this, m_quadID + "4/", (short)(m_leftX + (m_width / 2)), (short)(m_height + (m_height / 2)), (short)(m_width / 2), (short)(m_height / 2));
103 } 103 }
104 else 104 else
105 { 105 {
106 for (int i = 0; i < m_childNodes.Length; i++) 106 for (int i = 0; i < m_childNodes.Length; i++)
107 { 107 {
108 m_childNodes[i].Subdivide(); 108 m_childNodes[i].Subdivide();
109 } 109 }
110 } 110 }
111 } 111 }
112 112
113 public List<SceneObjectGroup> GetObjectsFrom(float x, float y) 113 public List<SceneObjectGroup> GetObjectsFrom(float x, float y)
114 { 114 {
115 if (m_childNodes == null) 115 if (m_childNodes == null)
116 { 116 {
117 return new List<SceneObjectGroup>(m_objects); 117 return new List<SceneObjectGroup>(m_objects);
118 } 118 }
119 else 119 else
120 { 120 {
121 if (x < m_leftX + (m_width / 2)) 121 if (x < m_leftX + (m_width / 2))
122 { 122 {
123 if (y < m_leftY + (m_height / 2)) 123 if (y < m_leftY + (m_height / 2))
124 { 124 {
125 return m_childNodes[0].GetObjectsFrom(x, y); 125 return m_childNodes[0].GetObjectsFrom(x, y);
126 } 126 }
127 else 127 else
128 { 128 {
129 return m_childNodes[2].GetObjectsFrom(x, y); 129 return m_childNodes[2].GetObjectsFrom(x, y);
130 } 130 }
131 } 131 }
132 else 132 else
133 { 133 {
134 if (y < m_leftY + (m_height / 2)) 134 if (y < m_leftY + (m_height / 2))
135 { 135 {
136 return m_childNodes[1].GetObjectsFrom(x, y); 136 return m_childNodes[1].GetObjectsFrom(x, y);
137 } 137 }
138 else 138 else
139 { 139 {
140 return m_childNodes[3].GetObjectsFrom(x, y); 140 return m_childNodes[3].GetObjectsFrom(x, y);
141 } 141 }
142 } 142 }
143 } 143 }
144 } 144 }
145 145
146 public List<SceneObjectGroup> GetObjectsFrom(string nodeName) 146 public List<SceneObjectGroup> GetObjectsFrom(string nodeName)
147 { 147 {
148 if (nodeName == m_quadID) 148 if (nodeName == m_quadID)
149 { 149 {
150 return new List<SceneObjectGroup>(m_objects); 150 return new List<SceneObjectGroup>(m_objects);
151 } 151 }
152 else if (m_childNodes != null) 152 else if (m_childNodes != null)
153 { 153 {
154 for (int i = 0; i < 4; i++) 154 for (int i = 0; i < 4; i++)
155 { 155 {
156 List<SceneObjectGroup> retVal; 156 List<SceneObjectGroup> retVal;
157 retVal = m_childNodes[i].GetObjectsFrom(nodeName); 157 retVal = m_childNodes[i].GetObjectsFrom(nodeName);
158 if (retVal != null) 158 if (retVal != null)
159 { 159 {
160 return retVal; 160 return retVal;
161 } 161 }
162 } 162 }
163 } 163 }
164 return null; 164 return null;
165 } 165 }
166 166
167 public string GetNodeID(float x, float y) 167 public string GetNodeID(float x, float y)
168 { 168 {
169 if (m_childNodes == null) 169 if (m_childNodes == null)
170 { 170 {
171 return m_quadID; 171 return m_quadID;
172 } 172 }
173 else 173 else
174 { 174 {
175 if (x < m_leftX + (m_width / 2)) 175 if (x < m_leftX + (m_width / 2))
176 { 176 {
177 if (y < m_leftY + (m_height / 2)) 177 if (y < m_leftY + (m_height / 2))
178 { 178 {
179 return m_childNodes[0].GetNodeID(x, y); 179 return m_childNodes[0].GetNodeID(x, y);
180 } 180 }
181 else 181 else
182 { 182 {
183 return m_childNodes[2].GetNodeID(x, y); 183 return m_childNodes[2].GetNodeID(x, y);
184 } 184 }
185 } 185 }
186 else 186 else
187 { 187 {
188 if (y < m_leftY + (m_height / 2)) 188 if (y < m_leftY + (m_height / 2))
189 { 189 {
190 return m_childNodes[1].GetNodeID(x, y); 190 return m_childNodes[1].GetNodeID(x, y);
191 } 191 }
192 else 192 else
193 { 193 {
194 return m_childNodes[3].GetNodeID(x, y); 194 return m_childNodes[3].GetNodeID(x, y);
195 } 195 }
196 } 196 }
197 } 197 }
198 } 198 }
199 199
200 public void Update() 200 public void Update()
201 { 201 {
202 if (m_childNodes != null) 202 if (m_childNodes != null)
203 { 203 {
204 for (int i = 0; i < 4; i++) 204 for (int i = 0; i < 4; i++)
205 { 205 {
206 m_childNodes[i].Update(); 206 m_childNodes[i].Update();
207 } 207 }
208 } 208 }
209 else 209 else
210 { 210 {
211 List<SceneObjectGroup> outBounds = new List<SceneObjectGroup>(); 211 List<SceneObjectGroup> outBounds = new List<SceneObjectGroup>();
212 foreach (SceneObjectGroup group in m_objects) 212 foreach (SceneObjectGroup group in m_objects)
213 { 213 {
214 if (((group.AbsolutePosition.X > m_leftX) && (group.AbsolutePosition.X < (m_leftX + m_width))) && ((group.AbsolutePosition.Y > m_leftY) && (group.AbsolutePosition.Y < (m_leftY + m_height)))) 214 if (((group.AbsolutePosition.X > m_leftX) && (group.AbsolutePosition.X < (m_leftX + m_width))) && ((group.AbsolutePosition.Y > m_leftY) && (group.AbsolutePosition.Y < (m_leftY + m_height))))
215 { 215 {
216 //still in bounds 216 //still in bounds
217 } 217 }
218 else 218 else
219 { 219 {
220 outBounds.Add(group); 220 outBounds.Add(group);
221 } 221 }
222 } 222 }
223 223
224 foreach (SceneObjectGroup removee in outBounds) 224 foreach (SceneObjectGroup removee in outBounds)
225 { 225 {
226 m_objects.Remove(removee); 226 m_objects.Remove(removee);
227 if (m_parent != null) 227 if (m_parent != null)
228 { 228 {
229 m_parent.PassUp(removee); 229 m_parent.PassUp(removee);
230 } 230 }
231 } 231 }
232 outBounds.Clear(); 232 outBounds.Clear();
233 } 233 }
234 } 234 }
235 235
236 public void PassUp(SceneObjectGroup group) 236 public void PassUp(SceneObjectGroup group)
237 { 237 {
238 if (((group.AbsolutePosition.X > m_leftX) && (group.AbsolutePosition.X < (m_leftX + m_width))) && ((group.AbsolutePosition.Y > m_leftY) && (group.AbsolutePosition.Y < (m_leftY + m_height)))) 238 if (((group.AbsolutePosition.X > m_leftX) && (group.AbsolutePosition.X < (m_leftX + m_width))) && ((group.AbsolutePosition.Y > m_leftY) && (group.AbsolutePosition.Y < (m_leftY + m_height))))
239 { 239 {
240 AddObject(group); 240 AddObject(group);
241 } 241 }
242 else 242 else
243 { 243 {
244 if (m_parent != null) 244 if (m_parent != null)
245 { 245 {
246 m_parent.PassUp(group); 246 m_parent.PassUp(group);
247 } 247 }
248 } 248 }
249 } 249 }
250 250
251 public string[] GetNeighbours(string nodeName) 251 public string[] GetNeighbours(string nodeName)
252 { 252 {
253 string[] retVal = new string[1]; 253 string[] retVal = new string[1];
254 retVal[0] = ""; 254 retVal[0] = "";
255 return retVal; 255 return retVal;
256 } 256 }
257 } 257 }
258} 258}
diff --git a/OpenSim/Region/Environment/Types/UpdateQueue.cs b/OpenSim/Region/Environment/Types/UpdateQueue.cs
index b21bcb6..442e9d5 100644
--- a/OpenSim/Region/Environment/Types/UpdateQueue.cs
+++ b/OpenSim/Region/Environment/Types/UpdateQueue.cs
@@ -1,79 +1,79 @@
1/* 1/*
2* Copyright (c) Contributors, http://opensimulator.org/ 2* Copyright (c) Contributors, http://opensimulator.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28 28
29using System.Collections.Generic; 29using System.Collections.Generic;
30using libsecondlife; 30using libsecondlife;
31using OpenSim.Region.Environment.Scenes; 31using OpenSim.Region.Environment.Scenes;
32 32
33namespace OpenSim.Region.Environment.Types 33namespace OpenSim.Region.Environment.Types
34{ 34{
35 public class UpdateQueue 35 public class UpdateQueue
36 { 36 {
37 private Queue<SceneObjectPart> m_queue; 37 private Queue<SceneObjectPart> m_queue;
38 38
39 private List<LLUUID> m_ids; 39 private List<LLUUID> m_ids;
40 40
41 public int Count 41 public int Count
42 { 42 {
43 get { return m_queue.Count; } 43 get { return m_queue.Count; }
44 } 44 }
45 45
46 public UpdateQueue() 46 public UpdateQueue()
47 { 47 {
48 m_queue = new Queue<SceneObjectPart>(); 48 m_queue = new Queue<SceneObjectPart>();
49 m_ids = new List<LLUUID>(); 49 m_ids = new List<LLUUID>();
50 } 50 }
51 51
52 public void Enqueue(SceneObjectPart part) 52 public void Enqueue(SceneObjectPart part)
53 { 53 {
54 lock (m_ids) 54 lock (m_ids)
55 { 55 {
56 if (!m_ids.Contains(part.UUID)) 56 if (!m_ids.Contains(part.UUID))
57 { 57 {
58 m_ids.Add(part.UUID); 58 m_ids.Add(part.UUID);
59 m_queue.Enqueue(part); 59 m_queue.Enqueue(part);
60 } 60 }
61 } 61 }
62 } 62 }
63 63
64 public SceneObjectPart Dequeue() 64 public SceneObjectPart Dequeue()
65 { 65 {
66 SceneObjectPart part = null; 66 SceneObjectPart part = null;
67 if (m_queue.Count > 0) 67 if (m_queue.Count > 0)
68 { 68 {
69 part = m_queue.Dequeue(); 69 part = m_queue.Dequeue();
70 lock (m_ids) 70 lock (m_ids)
71 { 71 {
72 m_ids.Remove(part.UUID); 72 m_ids.Remove(part.UUID);
73 } 73 }
74 } 74 }
75 75
76 return part; 76 return part;
77 } 77 }
78 } 78 }
79} 79}
diff --git a/OpenSim/Tests/Inventory/Properties/AssemblyInfo.cs b/OpenSim/Tests/Inventory/Properties/AssemblyInfo.cs
index dd537a5..cb89a71 100644
--- a/OpenSim/Tests/Inventory/Properties/AssemblyInfo.cs
+++ b/OpenSim/Tests/Inventory/Properties/AssemblyInfo.cs
@@ -1,35 +1,35 @@
1using System.Reflection; 1using System.Reflection;
2using System.Runtime.CompilerServices; 2using System.Runtime.CompilerServices;
3using System.Runtime.InteropServices; 3using System.Runtime.InteropServices;
4 4
5// General Information about an assembly is controlled through the following 5// General Information about an assembly is controlled through the following
6// set of attributes. Change these attribute values to modify the information 6// set of attributes. Change these attribute values to modify the information
7// associated with an assembly. 7// associated with an assembly.
8[assembly: AssemblyTitle("Inventory")] 8[assembly: AssemblyTitle("Inventory")]
9[assembly: AssemblyDescription("")] 9[assembly: AssemblyDescription("")]
10[assembly: AssemblyConfiguration("")] 10[assembly: AssemblyConfiguration("")]
11[assembly: AssemblyCompany("Lauridsen")] 11[assembly: AssemblyCompany("Lauridsen")]
12[assembly: AssemblyProduct("Inventory")] 12[assembly: AssemblyProduct("Inventory")]
13[assembly: AssemblyCopyright("Copyright © Lauridsen 2007")] 13[assembly: AssemblyCopyright("Copyright © Lauridsen 2007")]
14[assembly: AssemblyTrademark("")] 14[assembly: AssemblyTrademark("")]
15[assembly: AssemblyCulture("")] 15[assembly: AssemblyCulture("")]
16 16
17// Setting ComVisible to false makes the types in this assembly not visible 17// Setting ComVisible to false makes the types in this assembly not visible
18// to COM components. If you need to access a type in this assembly from 18// to COM components. If you need to access a type in this assembly from
19// COM, set the ComVisible attribute to true on that type. 19// COM, set the ComVisible attribute to true on that type.
20[assembly: ComVisible(false)] 20[assembly: ComVisible(false)]
21 21
22// The following GUID is for the ID of the typelib if this project is exposed to COM 22// The following GUID is for the ID of the typelib if this project is exposed to COM
23[assembly: Guid("2330add7-08a2-4f33-9ab8-74894fe7e3dd")] 23[assembly: Guid("2330add7-08a2-4f33-9ab8-74894fe7e3dd")]
24 24
25// Version information for an assembly consists of the following four values: 25// Version information for an assembly consists of the following four values:
26// 26//
27// Major Version 27// Major Version
28// Minor Version 28// Minor Version
29// Build Number 29// Build Number
30// Revision 30// Revision
31// 31//
32// You can specify all the values or you can default the Revision and Build Numbers 32// You can specify all the values or you can default the Revision and Build Numbers
33// by using the '*' as shown below: 33// by using the '*' as shown below:
34[assembly: AssemblyVersion("1.0.0.0")] 34[assembly: AssemblyVersion("1.0.0.0")]
35[assembly: AssemblyFileVersion("1.0.0.0")] 35[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenSim/Tests/Inventory/TestInventory.cs b/OpenSim/Tests/Inventory/TestInventory.cs
index 7f1ded8..f9a791f 100644
--- a/OpenSim/Tests/Inventory/TestInventory.cs
+++ b/OpenSim/Tests/Inventory/TestInventory.cs
@@ -1,1008 +1,1008 @@
1/* 1/*
2* Copyright (c) Contributors, http://opensimulator.org/ 2* Copyright (c) Contributors, http://opensimulator.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28 28
29using System; 29using System;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Text; 31using System.Text;
32using NUnit.Framework; 32using NUnit.Framework;
33 33
34using libsecondlife; 34using libsecondlife;
35using OpenSim.Framework.Types; 35using OpenSim.Framework.Types;
36using OpenSim.Framework.Data; 36using OpenSim.Framework.Data;
37using OpenSim.Framework.Data.SQLite; 37using OpenSim.Framework.Data.SQLite;
38using OpenSim.Framework.Data.MySQL; 38using OpenSim.Framework.Data.MySQL;
39using OpenSim.Framework.Console; 39using OpenSim.Framework.Console;
40 40
41namespace OpenSim.Test.Inventory 41namespace OpenSim.Test.Inventory
42{ 42{
43 [TestFixture] 43 [TestFixture]
44 public class TestInventory 44 public class TestInventory
45 { 45 {
46 IInventoryData _dbPlugin; 46 IInventoryData _dbPlugin;
47 LLUUID _agent_1_id; 47 LLUUID _agent_1_id;
48 public static LLUUID LibraryFolderRootUuid = new LLUUID("5926de2a-c2d7-4c11-ac4e-74512ffeb6d1"); 48 public static LLUUID LibraryFolderRootUuid = new LLUUID("5926de2a-c2d7-4c11-ac4e-74512ffeb6d1");
49 49
50 Random _rnd = new Random((int)DateTime.Now.Ticks); 50 Random _rnd = new Random((int)DateTime.Now.Ticks);
51 51
52 [TestFixtureSetUp] 52 [TestFixtureSetUp]
53 public void SetupInventoryTest() 53 public void SetupInventoryTest()
54 { 54 {
55 55
56 _agent_1_id = LLUUID.Random(); 56 _agent_1_id = LLUUID.Random();
57 57
58 MainLog.Instance = new LogBase("UnitTest.log", "TEST", null, true); 58 MainLog.Instance = new LogBase("UnitTest.log", "TEST", null, true);
59// _dbPlugin = new SQLiteInventoryStore(); 59// _dbPlugin = new SQLiteInventoryStore();
60 _dbPlugin = new MySQLInventoryData(); 60 _dbPlugin = new MySQLInventoryData();
61 _dbPlugin.Initialise(); 61 _dbPlugin.Initialise();
62 } 62 }
63 63
64 [TestFixtureTearDown] 64 [TestFixtureTearDown]
65 public void TeardownInventoryTest() 65 public void TeardownInventoryTest()
66 { 66 {
67 _dbPlugin.Close(); 67 _dbPlugin.Close();
68 } 68 }
69 69
70 private bool AreFoldersIdentical(InventoryFolderBase a, InventoryFolderBase b) 70 private bool AreFoldersIdentical(InventoryFolderBase a, InventoryFolderBase b)
71 { 71 {
72 if (a.agentID != b.agentID) return false; 72 if (a.agentID != b.agentID) return false;
73 if (a.folderID != b.folderID) return false; 73 if (a.folderID != b.folderID) return false;
74 if (a.name != b.name) return false; 74 if (a.name != b.name) return false;
75 if (a.parentID != b.parentID) return false; 75 if (a.parentID != b.parentID) return false;
76 if (a.type != b.type) return false; 76 if (a.type != b.type) return false;
77 if (a.version != b.version) return false; 77 if (a.version != b.version) return false;
78 return true; 78 return true;
79 } 79 }
80 80
81 private bool AreItemsIdentical(InventoryItemBase a, InventoryItemBase b) 81 private bool AreItemsIdentical(InventoryItemBase a, InventoryItemBase b)
82 { 82 {
83 if (a.assetID != b.assetID) return false; 83 if (a.assetID != b.assetID) return false;
84 if (a.assetType != b.assetType) return false; 84 if (a.assetType != b.assetType) return false;
85 if (a.avatarID != b.avatarID) return false; 85 if (a.avatarID != b.avatarID) return false;
86 if (a.creatorsID != b.creatorsID) return false; 86 if (a.creatorsID != b.creatorsID) return false;
87 if (a.inventoryBasePermissions != b.inventoryBasePermissions) return false; 87 if (a.inventoryBasePermissions != b.inventoryBasePermissions) return false;
88 if (a.inventoryCurrentPermissions != b.inventoryCurrentPermissions) return false; 88 if (a.inventoryCurrentPermissions != b.inventoryCurrentPermissions) return false;
89 if (a.inventoryEveryOnePermissions != b.inventoryEveryOnePermissions) return false; 89 if (a.inventoryEveryOnePermissions != b.inventoryEveryOnePermissions) return false;
90 if (a.inventoryNextPermissions != b.inventoryNextPermissions) return false; 90 if (a.inventoryNextPermissions != b.inventoryNextPermissions) return false;
91 if (a.inventoryID != b.inventoryID) return false; 91 if (a.inventoryID != b.inventoryID) return false;
92 if (a.inventoryDescription != b.inventoryDescription) return false; 92 if (a.inventoryDescription != b.inventoryDescription) return false;
93 if (a.inventoryName != b.inventoryName) return false; 93 if (a.inventoryName != b.inventoryName) return false;
94 if (a.invType != b.invType) return false; 94 if (a.invType != b.invType) return false;
95 if (a.parentFolderID != b.parentFolderID) return false; 95 if (a.parentFolderID != b.parentFolderID) return false;
96 return true; 96 return true;
97 } 97 }
98 98
99 /// <summary> 99 /// <summary>
100 /// Test that we can insert a root folder 100 /// Test that we can insert a root folder
101 /// </summary> 101 /// </summary>
102 [Test] 102 [Test]
103 public void T01_SetupRootFolder() 103 public void T01_SetupRootFolder()
104 { 104 {
105 InventoryFolderBase root = new InventoryFolderBase(); 105 InventoryFolderBase root = new InventoryFolderBase();
106 root.agentID = _agent_1_id; 106 root.agentID = _agent_1_id;
107 root.folderID = _agent_1_id; 107 root.folderID = _agent_1_id;
108 root.name = "Root folder"; 108 root.name = "Root folder";
109 root.parentID = LLUUID.Zero; 109 root.parentID = LLUUID.Zero;
110 root.type = 2; 110 root.type = 2;
111 root.version = 2; 111 root.version = 2;
112 _dbPlugin.addInventoryFolder(root); 112 _dbPlugin.addInventoryFolder(root);
113 113
114 InventoryFolderBase f = _dbPlugin.getInventoryFolder(root.folderID); 114 InventoryFolderBase f = _dbPlugin.getInventoryFolder(root.folderID);
115 Assert.IsNotNull(f, "Failed to get existing folder"); 115 Assert.IsNotNull(f, "Failed to get existing folder");
116 Assert.IsTrue(AreFoldersIdentical(root, f), "Difference between stored and retrieved folder data"); 116 Assert.IsTrue(AreFoldersIdentical(root, f), "Difference between stored and retrieved folder data");
117 117
118 // Test that we only get the root folder, based on it's id, i.e. any other gui will not find the folder 118 // Test that we only get the root folder, based on it's id, i.e. any other gui will not find the folder
119 f = _dbPlugin.getInventoryFolder(LLUUID.Zero); 119 f = _dbPlugin.getInventoryFolder(LLUUID.Zero);
120 Assert.IsNull(f, "get folder returned a folder, but shouldn't find one"); 120 Assert.IsNull(f, "get folder returned a folder, but shouldn't find one");
121 121
122 f = _dbPlugin.getInventoryFolder(LLUUID.Random()); 122 f = _dbPlugin.getInventoryFolder(LLUUID.Random());
123 Assert.IsNull(f, "get folder returned a folder, but shouldn't find one"); 123 Assert.IsNull(f, "get folder returned a folder, but shouldn't find one");
124 124
125 // test that we can delete the folder 125 // test that we can delete the folder
126 126
127 _dbPlugin.deleteInventoryFolder(_agent_1_id); 127 _dbPlugin.deleteInventoryFolder(_agent_1_id);
128 f = _dbPlugin.getInventoryFolder(root.folderID); 128 f = _dbPlugin.getInventoryFolder(root.folderID);
129 Assert.IsNull(f, "get folder returned a folder, but it should have been deleted"); 129 Assert.IsNull(f, "get folder returned a folder, but it should have been deleted");
130 } 130 }
131 131
132 /// <summary> 132 /// <summary>
133 /// Make sure that all folders reported as root folders are root folders 133 /// Make sure that all folders reported as root folders are root folders
134 /// </summary> 134 /// </summary>
135 [Test] 135 [Test]
136 public void T02_TestRootFolder() 136 public void T02_TestRootFolder()
137 { 137 {
138 InventoryFolderBase root = new InventoryFolderBase(); 138 InventoryFolderBase root = new InventoryFolderBase();
139 root.agentID = _agent_1_id; 139 root.agentID = _agent_1_id;
140 root.folderID = _agent_1_id; 140 root.folderID = _agent_1_id;
141 root.name = "Root folder"; 141 root.name = "Root folder";
142 root.parentID = LLUUID.Zero; 142 root.parentID = LLUUID.Zero;
143 root.type = 2; 143 root.type = 2;
144 root.version = 2; 144 root.version = 2;
145 _dbPlugin.addInventoryFolder(root); 145 _dbPlugin.addInventoryFolder(root);
146 146
147 List<InventoryFolderBase> folders = _dbPlugin.getUserRootFolders(_agent_1_id); 147 List<InventoryFolderBase> folders = _dbPlugin.getUserRootFolders(_agent_1_id);
148 Assert.IsNotNull(folders, "Failed to get rootfolders for user"); 148 Assert.IsNotNull(folders, "Failed to get rootfolders for user");
149 149
150 bool foundRoot = false; 150 bool foundRoot = false;
151 foreach(InventoryFolderBase f in folders) { 151 foreach(InventoryFolderBase f in folders) {
152 152
153 // a root folder has a zero valued LLUUID 153 // a root folder has a zero valued LLUUID
154 Assert.AreEqual(f.parentID, LLUUID.Zero, "non root folder returned"); 154 Assert.AreEqual(f.parentID, LLUUID.Zero, "non root folder returned");
155 155
156 156
157 if(f.agentID == root.agentID) 157 if(f.agentID == root.agentID)
158 { 158 {
159 // we cannot have two different user specific root folders 159 // we cannot have two different user specific root folders
160 Assert.IsFalse(foundRoot, "Two different user specific root folders returned"); 160 Assert.IsFalse(foundRoot, "Two different user specific root folders returned");
161 161
162 Assert.IsTrue(AreFoldersIdentical(root, f), "Difference between stored and retrieved folder data"); 162 Assert.IsTrue(AreFoldersIdentical(root, f), "Difference between stored and retrieved folder data");
163 foundRoot = false; 163 foundRoot = false;
164 } 164 }
165 } 165 }
166 _dbPlugin.deleteInventoryFolder(_agent_1_id); 166 _dbPlugin.deleteInventoryFolder(_agent_1_id);
167 } 167 }
168 168
169 /// <summary> 169 /// <summary>
170 /// Test of folder hierarchy 170 /// Test of folder hierarchy
171 /// </summary> 171 /// </summary>
172 [Test] 172 [Test]
173 public void T03_TestRootFolder() 173 public void T03_TestRootFolder()
174 { 174 {
175 InventoryFolderBase root = new InventoryFolderBase(); 175 InventoryFolderBase root = new InventoryFolderBase();
176 root.agentID = _agent_1_id; 176 root.agentID = _agent_1_id;
177 root.folderID = _agent_1_id; 177 root.folderID = _agent_1_id;
178 root.name = "Root folder"; 178 root.name = "Root folder";
179 root.parentID = LLUUID.Zero; 179 root.parentID = LLUUID.Zero;
180 root.type = 2; 180 root.type = 2;
181 root.version = 2; 181 root.version = 2;
182 _dbPlugin.addInventoryFolder(root); 182 _dbPlugin.addInventoryFolder(root);
183 183
184 List<InventoryFolderBase> folders = _dbPlugin.getInventoryFolders(_agent_1_id); 184 List<InventoryFolderBase> folders = _dbPlugin.getInventoryFolders(_agent_1_id);
185 Assert.IsNotNull(folders, "null was returned, but an empty list of subfolders were expected"); 185 Assert.IsNotNull(folders, "null was returned, but an empty list of subfolders were expected");
186 Assert.IsEmpty(folders, "non empty collection was returned, even though the list of sub-folders should be empty"); 186 Assert.IsEmpty(folders, "non empty collection was returned, even though the list of sub-folders should be empty");
187 187
188 InventoryFolderBase child1 = new InventoryFolderBase(); 188 InventoryFolderBase child1 = new InventoryFolderBase();
189 child1.agentID = _agent_1_id; 189 child1.agentID = _agent_1_id;
190 child1.folderID = LLUUID.Random(); 190 child1.folderID = LLUUID.Random();
191 child1.name = "Child 1"; 191 child1.name = "Child 1";
192 child1.parentID = root.folderID; 192 child1.parentID = root.folderID;
193 child1.type = 3; 193 child1.type = 3;
194 child1.version = 3; 194 child1.version = 3;
195 _dbPlugin.addInventoryFolder(child1); 195 _dbPlugin.addInventoryFolder(child1);
196 196
197 InventoryFolderBase child2 = new InventoryFolderBase(); 197 InventoryFolderBase child2 = new InventoryFolderBase();
198 child2.agentID = _agent_1_id; 198 child2.agentID = _agent_1_id;
199 child2.folderID = LLUUID.Random(); 199 child2.folderID = LLUUID.Random();
200 child2.name = "Child 2"; 200 child2.name = "Child 2";
201 child2.parentID = root.folderID; 201 child2.parentID = root.folderID;
202 child2.type = 4; 202 child2.type = 4;
203 child2.version = 4; 203 child2.version = 4;
204 _dbPlugin.addInventoryFolder(child2); 204 _dbPlugin.addInventoryFolder(child2);
205 205
206 folders = _dbPlugin.getInventoryFolders(_agent_1_id); 206 folders = _dbPlugin.getInventoryFolders(_agent_1_id);
207 Assert.IsNotNull(folders, "null was returned, but an empty list of subfolders were expected"); 207 Assert.IsNotNull(folders, "null was returned, but an empty list of subfolders were expected");
208 Assert.AreEqual(folders.Count, 2, "two children were reported as inserted into the root folder"); 208 Assert.AreEqual(folders.Count, 2, "two children were reported as inserted into the root folder");
209 209
210 bool foundChild1 = false; 210 bool foundChild1 = false;
211 bool foundChild2 = false; 211 bool foundChild2 = false;
212 212
213 foreach (InventoryFolderBase f in folders) 213 foreach (InventoryFolderBase f in folders)
214 { 214 {
215 if (f.folderID == child1.folderID) 215 if (f.folderID == child1.folderID)
216 { 216 {
217 Assert.IsTrue(AreFoldersIdentical(child1, f), "Difference between stored and retrieved folder data"); 217 Assert.IsTrue(AreFoldersIdentical(child1, f), "Difference between stored and retrieved folder data");
218 foundChild1 = true; 218 foundChild1 = true;
219 } 219 }
220 else if (f.folderID == child2.folderID) 220 else if (f.folderID == child2.folderID)
221 { 221 {
222 Assert.IsTrue(AreFoldersIdentical(child2, f), "Difference between stored and retrieved folder data"); 222 Assert.IsTrue(AreFoldersIdentical(child2, f), "Difference between stored and retrieved folder data");
223 foundChild2 = true; 223 foundChild2 = true;
224 } 224 }
225 else 225 else
226 { 226 {
227 Assert.Fail("found unknown child folder"); 227 Assert.Fail("found unknown child folder");
228 } 228 }
229 } 229 }
230 230
231 if (foundChild1 == false || foundChild2 == false) 231 if (foundChild1 == false || foundChild2 == false)
232 { 232 {
233 Assert.Fail("one of the two child folders was not returned"); 233 Assert.Fail("one of the two child folders was not returned");
234 } 234 }
235 235
236 _dbPlugin.deleteInventoryFolder(child2.folderID); 236 _dbPlugin.deleteInventoryFolder(child2.folderID);
237 _dbPlugin.deleteInventoryFolder(child1.folderID); 237 _dbPlugin.deleteInventoryFolder(child1.folderID);
238 _dbPlugin.deleteInventoryFolder(_agent_1_id); 238 _dbPlugin.deleteInventoryFolder(_agent_1_id);
239 } 239 }
240 240
241 /// <summary> 241 /// <summary>
242 /// Test of folder hierarchy, and deletion 242 /// Test of folder hierarchy, and deletion
243 /// </summary> 243 /// </summary>
244 [Test] 244 [Test]
245 public void T04_TestRootFolder() 245 public void T04_TestRootFolder()
246 { 246 {
247 InventoryFolderBase root = new InventoryFolderBase(); 247 InventoryFolderBase root = new InventoryFolderBase();
248 root.agentID = _agent_1_id; 248 root.agentID = _agent_1_id;
249 root.folderID = _agent_1_id; 249 root.folderID = _agent_1_id;
250 root.name = "Root folder"; 250 root.name = "Root folder";
251 root.parentID = LLUUID.Zero; 251 root.parentID = LLUUID.Zero;
252 root.type = 2; 252 root.type = 2;
253 root.version = 2; 253 root.version = 2;
254 _dbPlugin.addInventoryFolder(root); 254 _dbPlugin.addInventoryFolder(root);
255 255
256 InventoryFolderBase child1 = new InventoryFolderBase(); 256 InventoryFolderBase child1 = new InventoryFolderBase();
257 child1.agentID = _agent_1_id; 257 child1.agentID = _agent_1_id;
258 child1.folderID = LLUUID.Random(); 258 child1.folderID = LLUUID.Random();
259 child1.name = "Child 1"; 259 child1.name = "Child 1";
260 child1.parentID = root.folderID; 260 child1.parentID = root.folderID;
261 child1.type = 3; 261 child1.type = 3;
262 child1.version = 3; 262 child1.version = 3;
263 _dbPlugin.addInventoryFolder(child1); 263 _dbPlugin.addInventoryFolder(child1);
264 264
265 InventoryFolderBase child2 = new InventoryFolderBase(); 265 InventoryFolderBase child2 = new InventoryFolderBase();
266 child2.agentID = _agent_1_id; 266 child2.agentID = _agent_1_id;
267 child2.folderID = LLUUID.Random(); 267 child2.folderID = LLUUID.Random();
268 child2.name = "Child 2"; 268 child2.name = "Child 2";
269 child2.parentID = root.folderID; 269 child2.parentID = root.folderID;
270 child2.type = 4; 270 child2.type = 4;
271 child2.version = 4; 271 child2.version = 4;
272 _dbPlugin.addInventoryFolder(child2); 272 _dbPlugin.addInventoryFolder(child2);
273 273
274 _dbPlugin.deleteInventoryFolder(_agent_1_id); 274 _dbPlugin.deleteInventoryFolder(_agent_1_id);
275 275
276 List<InventoryFolderBase> folders = _dbPlugin.getInventoryFolders(_agent_1_id); 276 List<InventoryFolderBase> folders = _dbPlugin.getInventoryFolders(_agent_1_id);
277 Assert.IsNotNull(folders, "null was returned, but an empty list of subfolders were expected"); 277 Assert.IsNotNull(folders, "null was returned, but an empty list of subfolders were expected");
278 Assert.IsEmpty(folders, "non empty collection was returned, even though the list of sub-folders should be empty"); 278 Assert.IsEmpty(folders, "non empty collection was returned, even though the list of sub-folders should be empty");
279 279
280 InventoryFolderBase f = _dbPlugin.getInventoryFolder(_agent_1_id); 280 InventoryFolderBase f = _dbPlugin.getInventoryFolder(_agent_1_id);
281 Assert.IsNull(f, "Folder was returned, even though is has been deleted"); 281 Assert.IsNull(f, "Folder was returned, even though is has been deleted");
282 282
283 f = _dbPlugin.getInventoryFolder(child1.folderID); 283 f = _dbPlugin.getInventoryFolder(child1.folderID);
284 Assert.IsNull(f, "Folder was returned, even though is has been deleted"); 284 Assert.IsNull(f, "Folder was returned, even though is has been deleted");
285 285
286 f = _dbPlugin.getInventoryFolder(child2.folderID); 286 f = _dbPlugin.getInventoryFolder(child2.folderID);
287 Assert.IsNull(f, "Folder was returned, even though is has been deleted"); 287 Assert.IsNull(f, "Folder was returned, even though is has been deleted");
288 } 288 }
289 289
290 /// <summary> 290 /// <summary>
291 /// Folder update 291 /// Folder update
292 /// </summary> 292 /// </summary>
293 [Test] 293 [Test]
294 public void T05_UpdateFolder() 294 public void T05_UpdateFolder()
295 { 295 {
296 InventoryFolderBase root = new InventoryFolderBase(); 296 InventoryFolderBase root = new InventoryFolderBase();
297 root.agentID = _agent_1_id; 297 root.agentID = _agent_1_id;
298 root.folderID = _agent_1_id; 298 root.folderID = _agent_1_id;
299 root.name = "Root folder"; 299 root.name = "Root folder";
300 root.parentID = LLUUID.Zero; 300 root.parentID = LLUUID.Zero;
301 root.type = 2; 301 root.type = 2;
302 root.version = 2; 302 root.version = 2;
303 _dbPlugin.addInventoryFolder(root); 303 _dbPlugin.addInventoryFolder(root);
304 304
305 InventoryFolderBase f = _dbPlugin.getInventoryFolder(_agent_1_id); 305 InventoryFolderBase f = _dbPlugin.getInventoryFolder(_agent_1_id);
306 Assert.IsTrue(AreFoldersIdentical(root, f), "Difference between stored and retrieved folder data"); 306 Assert.IsTrue(AreFoldersIdentical(root, f), "Difference between stored and retrieved folder data");
307 307
308 root.agentID = LLUUID.Random(); 308 root.agentID = LLUUID.Random();
309 _dbPlugin.updateInventoryFolder(root); 309 _dbPlugin.updateInventoryFolder(root);
310 f = _dbPlugin.getInventoryFolder(root.folderID); 310 f = _dbPlugin.getInventoryFolder(root.folderID);
311 Assert.IsTrue(AreFoldersIdentical(root, f), "Difference between stored and retrieved folder data"); 311 Assert.IsTrue(AreFoldersIdentical(root, f), "Difference between stored and retrieved folder data");
312 312
313 root.folderID = LLUUID.Random(); 313 root.folderID = LLUUID.Random();
314 _dbPlugin.updateInventoryFolder(root); 314 _dbPlugin.updateInventoryFolder(root);
315 f = _dbPlugin.getInventoryFolder(root.folderID); 315 f = _dbPlugin.getInventoryFolder(root.folderID);
316 Assert.IsTrue(AreFoldersIdentical(root, f), "Difference between stored and retrieved folder data"); 316 Assert.IsTrue(AreFoldersIdentical(root, f), "Difference between stored and retrieved folder data");
317 317
318 root.name = "Root folder 2"; 318 root.name = "Root folder 2";
319 _dbPlugin.updateInventoryFolder(root); 319 _dbPlugin.updateInventoryFolder(root);
320 f = _dbPlugin.getInventoryFolder(root.folderID); 320 f = _dbPlugin.getInventoryFolder(root.folderID);
321 Assert.IsTrue(AreFoldersIdentical(root, f), "Difference between stored and retrieved folder data"); 321 Assert.IsTrue(AreFoldersIdentical(root, f), "Difference between stored and retrieved folder data");
322 322
323 root.parentID = LLUUID.Random(); 323 root.parentID = LLUUID.Random();
324 _dbPlugin.updateInventoryFolder(root); 324 _dbPlugin.updateInventoryFolder(root);
325 f = _dbPlugin.getInventoryFolder(root.folderID); 325 f = _dbPlugin.getInventoryFolder(root.folderID);
326 Assert.IsTrue(AreFoldersIdentical(root, f), "Difference between stored and retrieved folder data"); 326 Assert.IsTrue(AreFoldersIdentical(root, f), "Difference between stored and retrieved folder data");
327 327
328 root.type = (short)(root.type + 1); 328 root.type = (short)(root.type + 1);
329 _dbPlugin.updateInventoryFolder(root); 329 _dbPlugin.updateInventoryFolder(root);
330 f = _dbPlugin.getInventoryFolder(root.folderID); 330 f = _dbPlugin.getInventoryFolder(root.folderID);
331 Assert.IsTrue(AreFoldersIdentical(root, f), "Difference between stored and retrieved folder data"); 331 Assert.IsTrue(AreFoldersIdentical(root, f), "Difference between stored and retrieved folder data");
332 332
333 root.version = (ushort)(root.version + 1); 333 root.version = (ushort)(root.version + 1);
334 _dbPlugin.updateInventoryFolder(root); 334 _dbPlugin.updateInventoryFolder(root);
335 f = _dbPlugin.getInventoryFolder(root.folderID); 335 f = _dbPlugin.getInventoryFolder(root.folderID);
336 Assert.IsTrue(AreFoldersIdentical(root, f), "Difference between stored and retrieved folder data"); 336 Assert.IsTrue(AreFoldersIdentical(root, f), "Difference between stored and retrieved folder data");
337 337
338 _dbPlugin.deleteInventoryFolder(_agent_1_id); 338 _dbPlugin.deleteInventoryFolder(_agent_1_id);
339 _dbPlugin.deleteInventoryFolder(root.folderID); 339 _dbPlugin.deleteInventoryFolder(root.folderID);
340 } 340 }
341 341
342 /// <summary> 342 /// <summary>
343 /// Test that we can insert a root folder 343 /// Test that we can insert a root folder
344 /// </summary> 344 /// </summary>
345 [Test] 345 [Test]
346 public void T06_SetupInventoryWithItems() 346 public void T06_SetupInventoryWithItems()
347 { 347 {
348 348
349 // Setup inventory 349 // Setup inventory
350 InventoryFolderBase root = new InventoryFolderBase(); 350 InventoryFolderBase root = new InventoryFolderBase();
351 root.agentID = _agent_1_id; 351 root.agentID = _agent_1_id;
352 root.folderID = _agent_1_id; 352 root.folderID = _agent_1_id;
353 root.name = "Root folder"; 353 root.name = "Root folder";
354 root.parentID = LLUUID.Zero; 354 root.parentID = LLUUID.Zero;
355 root.type = 2; 355 root.type = 2;
356 root.version = 2; 356 root.version = 2;
357 _dbPlugin.addInventoryFolder(root); 357 _dbPlugin.addInventoryFolder(root);
358 358
359 InventoryFolderBase child1 = new InventoryFolderBase(); 359 InventoryFolderBase child1 = new InventoryFolderBase();
360 child1.agentID = _agent_1_id; 360 child1.agentID = _agent_1_id;
361 child1.folderID = LLUUID.Random(); 361 child1.folderID = LLUUID.Random();
362 child1.name = "Child 1"; 362 child1.name = "Child 1";
363 child1.parentID = root.folderID; 363 child1.parentID = root.folderID;
364 child1.type = 3; 364 child1.type = 3;
365 child1.version = 3; 365 child1.version = 3;
366 _dbPlugin.addInventoryFolder(child1); 366 _dbPlugin.addInventoryFolder(child1);
367 367
368 InventoryFolderBase child1Child = new InventoryFolderBase(); 368 InventoryFolderBase child1Child = new InventoryFolderBase();
369 child1Child.agentID = _agent_1_id; 369 child1Child.agentID = _agent_1_id;
370 child1Child.folderID = LLUUID.Random(); 370 child1Child.folderID = LLUUID.Random();
371 child1Child.name = "Child 1 child"; 371 child1Child.name = "Child 1 child";
372 child1Child.parentID = child1.folderID; 372 child1Child.parentID = child1.folderID;
373 child1Child.type = 4; 373 child1Child.type = 4;
374 child1Child.version = 4; 374 child1Child.version = 4;
375 _dbPlugin.addInventoryFolder(child1Child); 375 _dbPlugin.addInventoryFolder(child1Child);
376 376
377 InventoryFolderBase child2 = new InventoryFolderBase(); 377 InventoryFolderBase child2 = new InventoryFolderBase();
378 child2.agentID = _agent_1_id; 378 child2.agentID = _agent_1_id;
379 child2.folderID = LLUUID.Random(); 379 child2.folderID = LLUUID.Random();
380 child2.name = "Child 2"; 380 child2.name = "Child 2";
381 child2.parentID = root.folderID; 381 child2.parentID = root.folderID;
382 child2.type = 5; 382 child2.type = 5;
383 child2.version = 5; 383 child2.version = 5;
384 _dbPlugin.addInventoryFolder(child2); 384 _dbPlugin.addInventoryFolder(child2);
385 385
386 InventoryFolderBase child2Child = new InventoryFolderBase(); 386 InventoryFolderBase child2Child = new InventoryFolderBase();
387 child2Child.agentID = _agent_1_id; 387 child2Child.agentID = _agent_1_id;
388 child2Child.folderID = LLUUID.Random(); 388 child2Child.folderID = LLUUID.Random();
389 child2Child.name = "Child 2 child"; 389 child2Child.name = "Child 2 child";
390 child2Child.parentID = child2.folderID; 390 child2Child.parentID = child2.folderID;
391 child2Child.type = 6; 391 child2Child.type = 6;
392 child2Child.version = 6; 392 child2Child.version = 6;
393 _dbPlugin.addInventoryFolder(child2Child); 393 _dbPlugin.addInventoryFolder(child2Child);
394 394
395 InventoryItemBase rootItem = new InventoryItemBase(); 395 InventoryItemBase rootItem = new InventoryItemBase();
396 rootItem.assetID = LLUUID.Random(); 396 rootItem.assetID = LLUUID.Random();
397 rootItem.assetType = _rnd.Next(1, 1000); 397 rootItem.assetType = _rnd.Next(1, 1000);
398 rootItem.avatarID = _agent_1_id; 398 rootItem.avatarID = _agent_1_id;
399 rootItem.creatorsID = LLUUID.Random(); 399 rootItem.creatorsID = LLUUID.Random();
400 rootItem.inventoryBasePermissions = (uint)_rnd.Next(1,1000000); 400 rootItem.inventoryBasePermissions = (uint)_rnd.Next(1,1000000);
401 rootItem.inventoryCurrentPermissions = (uint)_rnd.Next(1, 1000000); 401 rootItem.inventoryCurrentPermissions = (uint)_rnd.Next(1, 1000000);
402 rootItem.inventoryEveryOnePermissions = (uint)_rnd.Next(1, 1000000); 402 rootItem.inventoryEveryOnePermissions = (uint)_rnd.Next(1, 1000000);
403 rootItem.inventoryNextPermissions = (uint)_rnd.Next(1, 1000000); 403 rootItem.inventoryNextPermissions = (uint)_rnd.Next(1, 1000000);
404 rootItem.inventoryID = LLUUID.Random(); 404 rootItem.inventoryID = LLUUID.Random();
405 rootItem.inventoryDescription = "Root item, Description"; 405 rootItem.inventoryDescription = "Root item, Description";
406 rootItem.inventoryName = "Root item"; 406 rootItem.inventoryName = "Root item";
407 rootItem.invType = _rnd.Next(1, 1000); 407 rootItem.invType = _rnd.Next(1, 1000);
408 rootItem.parentFolderID = root.folderID; 408 rootItem.parentFolderID = root.folderID;
409 _dbPlugin.addInventoryItem(rootItem); 409 _dbPlugin.addInventoryItem(rootItem);
410 410
411 InventoryItemBase child1Item = new InventoryItemBase(); 411 InventoryItemBase child1Item = new InventoryItemBase();
412 child1Item.assetID = LLUUID.Random(); 412 child1Item.assetID = LLUUID.Random();
413 child1Item.assetType = _rnd.Next(1, 1000); 413 child1Item.assetType = _rnd.Next(1, 1000);
414 child1Item.avatarID = _agent_1_id; 414 child1Item.avatarID = _agent_1_id;
415 child1Item.creatorsID = LLUUID.Random(); 415 child1Item.creatorsID = LLUUID.Random();
416 child1Item.inventoryBasePermissions = (uint)_rnd.Next(1, 1000000); 416 child1Item.inventoryBasePermissions = (uint)_rnd.Next(1, 1000000);
417 child1Item.inventoryCurrentPermissions = (uint)_rnd.Next(1, 1000000); 417 child1Item.inventoryCurrentPermissions = (uint)_rnd.Next(1, 1000000);
418 child1Item.inventoryEveryOnePermissions = (uint)_rnd.Next(1, 1000000); 418 child1Item.inventoryEveryOnePermissions = (uint)_rnd.Next(1, 1000000);
419 child1Item.inventoryNextPermissions = (uint)_rnd.Next(1, 1000000); 419 child1Item.inventoryNextPermissions = (uint)_rnd.Next(1, 1000000);
420 child1Item.inventoryID = LLUUID.Random(); 420 child1Item.inventoryID = LLUUID.Random();
421 child1Item.inventoryDescription = "child1 item, Description"; 421 child1Item.inventoryDescription = "child1 item, Description";
422 child1Item.inventoryName = "child1 item"; 422 child1Item.inventoryName = "child1 item";
423 child1Item.invType = _rnd.Next(1, 1000); 423 child1Item.invType = _rnd.Next(1, 1000);
424 child1Item.parentFolderID = child1.folderID; 424 child1Item.parentFolderID = child1.folderID;
425 _dbPlugin.addInventoryItem(child1Item); 425 _dbPlugin.addInventoryItem(child1Item);
426 426
427 InventoryItemBase child1ChildItem = new InventoryItemBase(); 427 InventoryItemBase child1ChildItem = new InventoryItemBase();
428 child1ChildItem.assetID = LLUUID.Random(); 428 child1ChildItem.assetID = LLUUID.Random();
429 child1ChildItem.assetType = _rnd.Next(1, 1000); 429 child1ChildItem.assetType = _rnd.Next(1, 1000);
430 child1ChildItem.avatarID = _agent_1_id; 430 child1ChildItem.avatarID = _agent_1_id;
431 child1ChildItem.creatorsID = LLUUID.Random(); 431 child1ChildItem.creatorsID = LLUUID.Random();
432 child1ChildItem.inventoryBasePermissions = (uint)_rnd.Next(1, 1000000); 432 child1ChildItem.inventoryBasePermissions = (uint)_rnd.Next(1, 1000000);
433 child1ChildItem.inventoryCurrentPermissions = (uint)_rnd.Next(1, 1000000); 433 child1ChildItem.inventoryCurrentPermissions = (uint)_rnd.Next(1, 1000000);
434 child1ChildItem.inventoryEveryOnePermissions = (uint)_rnd.Next(1, 1000000); 434 child1ChildItem.inventoryEveryOnePermissions = (uint)_rnd.Next(1, 1000000);
435 child1ChildItem.inventoryNextPermissions = (uint)_rnd.Next(1, 1000000); 435 child1ChildItem.inventoryNextPermissions = (uint)_rnd.Next(1, 1000000);
436 child1ChildItem.inventoryID = LLUUID.Random(); 436 child1ChildItem.inventoryID = LLUUID.Random();
437 child1ChildItem.inventoryDescription = "child1Child item, Description"; 437 child1ChildItem.inventoryDescription = "child1Child item, Description";
438 child1ChildItem.inventoryName = "child1Child item"; 438 child1ChildItem.inventoryName = "child1Child item";
439 child1ChildItem.invType = _rnd.Next(1, 1000); 439 child1ChildItem.invType = _rnd.Next(1, 1000);
440 child1ChildItem.parentFolderID = child1Child.folderID; 440 child1ChildItem.parentFolderID = child1Child.folderID;
441 _dbPlugin.addInventoryItem(child1ChildItem); 441 _dbPlugin.addInventoryItem(child1ChildItem);
442 442
443 InventoryItemBase child2Item = new InventoryItemBase(); 443 InventoryItemBase child2Item = new InventoryItemBase();
444 child2Item.assetID = LLUUID.Random(); 444 child2Item.assetID = LLUUID.Random();
445 child2Item.assetType = _rnd.Next(1, 1000); 445 child2Item.assetType = _rnd.Next(1, 1000);
446 child2Item.avatarID = _agent_1_id; 446 child2Item.avatarID = _agent_1_id;
447 child2Item.creatorsID = LLUUID.Random(); 447 child2Item.creatorsID = LLUUID.Random();
448 child2Item.inventoryBasePermissions = (uint)_rnd.Next(1, 1000000); 448 child2Item.inventoryBasePermissions = (uint)_rnd.Next(1, 1000000);
449 child2Item.inventoryCurrentPermissions = (uint)_rnd.Next(1, 1000000); 449 child2Item.inventoryCurrentPermissions = (uint)_rnd.Next(1, 1000000);
450 child2Item.inventoryEveryOnePermissions = (uint)_rnd.Next(1, 1000000); 450 child2Item.inventoryEveryOnePermissions = (uint)_rnd.Next(1, 1000000);
451 child2Item.inventoryNextPermissions = (uint)_rnd.Next(1, 1000000); 451 child2Item.inventoryNextPermissions = (uint)_rnd.Next(1, 1000000);
452 child2Item.inventoryID = LLUUID.Random(); 452 child2Item.inventoryID = LLUUID.Random();
453 child2Item.inventoryDescription = "child2 item, Description"; 453 child2Item.inventoryDescription = "child2 item, Description";
454 child2Item.inventoryName = "child2 item"; 454 child2Item.inventoryName = "child2 item";
455 child2Item.invType = _rnd.Next(1, 1000); 455 child2Item.invType = _rnd.Next(1, 1000);
456 child2Item.parentFolderID = child2.folderID; 456 child2Item.parentFolderID = child2.folderID;
457 _dbPlugin.addInventoryItem(child2Item); 457 _dbPlugin.addInventoryItem(child2Item);
458 458
459 InventoryItemBase child2ChildItem = new InventoryItemBase(); 459 InventoryItemBase child2ChildItem = new InventoryItemBase();
460 child2ChildItem.assetID = LLUUID.Random(); 460 child2ChildItem.assetID = LLUUID.Random();
461 child2ChildItem.assetType = _rnd.Next(1, 1000); 461 child2ChildItem.assetType = _rnd.Next(1, 1000);
462 child2ChildItem.avatarID = _agent_1_id; 462 child2ChildItem.avatarID = _agent_1_id;
463 child2ChildItem.creatorsID = LLUUID.Random(); 463 child2ChildItem.creatorsID = LLUUID.Random();
464 child2ChildItem.inventoryBasePermissions = (uint)_rnd.Next(1, 1000000); 464 child2ChildItem.inventoryBasePermissions = (uint)_rnd.Next(1, 1000000);
465 child2ChildItem.inventoryCurrentPermissions = (uint)_rnd.Next(1, 1000000); 465 child2ChildItem.inventoryCurrentPermissions = (uint)_rnd.Next(1, 1000000);
466 child2ChildItem.inventoryEveryOnePermissions = (uint)_rnd.Next(1, 1000000); 466 child2ChildItem.inventoryEveryOnePermissions = (uint)_rnd.Next(1, 1000000);
467 child2ChildItem.inventoryNextPermissions = (uint)_rnd.Next(1, 1000000); 467 child2ChildItem.inventoryNextPermissions = (uint)_rnd.Next(1, 1000000);
468 child2ChildItem.inventoryID = LLUUID.Random(); 468 child2ChildItem.inventoryID = LLUUID.Random();
469 child2ChildItem.inventoryDescription = "child2Child item, Description"; 469 child2ChildItem.inventoryDescription = "child2Child item, Description";
470 child2ChildItem.inventoryName = "child2Child item"; 470 child2ChildItem.inventoryName = "child2Child item";
471 child2ChildItem.invType = _rnd.Next(1, 1000); 471 child2ChildItem.invType = _rnd.Next(1, 1000);
472 child2ChildItem.parentFolderID = child2Child.folderID; 472 child2ChildItem.parentFolderID = child2Child.folderID;
473 _dbPlugin.addInventoryItem(child2ChildItem); 473 _dbPlugin.addInventoryItem(child2ChildItem);
474 474
475 // test read of items 475 // test read of items
476 476
477 InventoryItemBase item = _dbPlugin.getInventoryItem(rootItem.inventoryID); 477 InventoryItemBase item = _dbPlugin.getInventoryItem(rootItem.inventoryID);
478 Assert.IsTrue(AreItemsIdentical(rootItem, item)); 478 Assert.IsTrue(AreItemsIdentical(rootItem, item));
479 479
480 item = _dbPlugin.getInventoryItem(child1Item.inventoryID); 480 item = _dbPlugin.getInventoryItem(child1Item.inventoryID);
481 Assert.IsTrue(AreItemsIdentical(child1Item, item)); 481 Assert.IsTrue(AreItemsIdentical(child1Item, item));
482 482
483 item = _dbPlugin.getInventoryItem(child1ChildItem.inventoryID); 483 item = _dbPlugin.getInventoryItem(child1ChildItem.inventoryID);
484 Assert.IsTrue(AreItemsIdentical(child1ChildItem, item)); 484 Assert.IsTrue(AreItemsIdentical(child1ChildItem, item));
485 485
486 item = _dbPlugin.getInventoryItem(child2Item.inventoryID); 486 item = _dbPlugin.getInventoryItem(child2Item.inventoryID);
487 Assert.IsTrue(AreItemsIdentical(child2Item, item)); 487 Assert.IsTrue(AreItemsIdentical(child2Item, item));
488 488
489 item = _dbPlugin.getInventoryItem(child2ChildItem.inventoryID); 489 item = _dbPlugin.getInventoryItem(child2ChildItem.inventoryID);
490 Assert.IsTrue(AreItemsIdentical(child2ChildItem, item)); 490 Assert.IsTrue(AreItemsIdentical(child2ChildItem, item));
491 491
492 _dbPlugin.deleteInventoryItem(rootItem.inventoryID); 492 _dbPlugin.deleteInventoryItem(rootItem.inventoryID);
493 _dbPlugin.deleteInventoryItem(child1Item.inventoryID); 493 _dbPlugin.deleteInventoryItem(child1Item.inventoryID);
494 _dbPlugin.deleteInventoryItem(child1ChildItem.inventoryID); 494 _dbPlugin.deleteInventoryItem(child1ChildItem.inventoryID);
495 _dbPlugin.deleteInventoryItem(child2Item.inventoryID); 495 _dbPlugin.deleteInventoryItem(child2Item.inventoryID);
496 _dbPlugin.deleteInventoryItem(child2ChildItem.inventoryID); 496 _dbPlugin.deleteInventoryItem(child2ChildItem.inventoryID);
497 } 497 }
498 498
499 /// <summary> 499 /// <summary>
500 /// Test that we can insert a root folder 500 /// Test that we can insert a root folder
501 /// </summary> 501 /// </summary>
502 [Test] 502 [Test]
503 public void T07_DeleteInventoryWithItems() 503 public void T07_DeleteInventoryWithItems()
504 { 504 {
505 505
506 // Setup inventory 506 // Setup inventory
507 InventoryFolderBase root = new InventoryFolderBase(); 507 InventoryFolderBase root = new InventoryFolderBase();
508 root.agentID = _agent_1_id; 508 root.agentID = _agent_1_id;
509 root.folderID = _agent_1_id; 509 root.folderID = _agent_1_id;
510 root.name = "Root folder"; 510 root.name = "Root folder";
511 root.parentID = LLUUID.Zero; 511 root.parentID = LLUUID.Zero;
512 root.type = 2; 512 root.type = 2;
513 root.version = 2; 513 root.version = 2;
514 _dbPlugin.addInventoryFolder(root); 514 _dbPlugin.addInventoryFolder(root);
515 515
516 InventoryFolderBase child1 = new InventoryFolderBase(); 516 InventoryFolderBase child1 = new InventoryFolderBase();
517 child1.agentID = _agent_1_id; 517 child1.agentID = _agent_1_id;
518 child1.folderID = LLUUID.Random(); 518 child1.folderID = LLUUID.Random();
519 child1.name = "Child 1"; 519 child1.name = "Child 1";
520 child1.parentID = root.folderID; 520 child1.parentID = root.folderID;
521 child1.type = 3; 521 child1.type = 3;
522 child1.version = 3; 522 child1.version = 3;
523 _dbPlugin.addInventoryFolder(child1); 523 _dbPlugin.addInventoryFolder(child1);
524 524
525 InventoryFolderBase child1Child = new InventoryFolderBase(); 525 InventoryFolderBase child1Child = new InventoryFolderBase();
526 child1Child.agentID = _agent_1_id; 526 child1Child.agentID = _agent_1_id;
527 child1Child.folderID = LLUUID.Random(); 527 child1Child.folderID = LLUUID.Random();
528 child1Child.name = "Child 1 child"; 528 child1Child.name = "Child 1 child";
529 child1Child.parentID = child1.folderID; 529 child1Child.parentID = child1.folderID;
530 child1Child.type = 4; 530 child1Child.type = 4;
531 child1Child.version = 4; 531 child1Child.version = 4;
532 _dbPlugin.addInventoryFolder(child1Child); 532 _dbPlugin.addInventoryFolder(child1Child);
533 533
534 InventoryFolderBase child2 = new InventoryFolderBase(); 534 InventoryFolderBase child2 = new InventoryFolderBase();
535 child2.agentID = _agent_1_id; 535 child2.agentID = _agent_1_id;
536 child2.folderID = LLUUID.Random(); 536 child2.folderID = LLUUID.Random();
537 child2.name = "Child 2"; 537 child2.name = "Child 2";
538 child2.parentID = root.folderID; 538 child2.parentID = root.folderID;
539 child2.type = 5; 539 child2.type = 5;
540 child2.version = 5; 540 child2.version = 5;
541 _dbPlugin.addInventoryFolder(child2); 541 _dbPlugin.addInventoryFolder(child2);
542 542
543 InventoryFolderBase child2Child = new InventoryFolderBase(); 543 InventoryFolderBase child2Child = new InventoryFolderBase();
544 child2Child.agentID = _agent_1_id; 544 child2Child.agentID = _agent_1_id;
545 child2Child.folderID = LLUUID.Random(); 545 child2Child.folderID = LLUUID.Random();
546 child2Child.name = "Child 2 child"; 546 child2Child.name = "Child 2 child";
547 child2Child.parentID = child2.folderID; 547 child2Child.parentID = child2.folderID;
548 child2Child.type = 6; 548 child2Child.type = 6;
549 child2Child.version = 6; 549 child2Child.version = 6;
550 _dbPlugin.addInventoryFolder(child2Child); 550 _dbPlugin.addInventoryFolder(child2Child);
551 551
552 InventoryItemBase rootItem = new InventoryItemBase(); 552 InventoryItemBase rootItem = new InventoryItemBase();
553 rootItem.assetID = LLUUID.Random(); 553 rootItem.assetID = LLUUID.Random();
554 rootItem.assetType = _rnd.Next(1, 1000); 554 rootItem.assetType = _rnd.Next(1, 1000);
555 rootItem.avatarID = _agent_1_id; 555 rootItem.avatarID = _agent_1_id;
556 rootItem.creatorsID = LLUUID.Random(); 556 rootItem.creatorsID = LLUUID.Random();
557 rootItem.inventoryBasePermissions = (uint)_rnd.Next(1, 1000000); 557 rootItem.inventoryBasePermissions = (uint)_rnd.Next(1, 1000000);
558 rootItem.inventoryCurrentPermissions = (uint)_rnd.Next(1, 1000000); 558 rootItem.inventoryCurrentPermissions = (uint)_rnd.Next(1, 1000000);
559 rootItem.inventoryEveryOnePermissions = (uint)_rnd.Next(1, 1000000); 559 rootItem.inventoryEveryOnePermissions = (uint)_rnd.Next(1, 1000000);
560 rootItem.inventoryNextPermissions = (uint)_rnd.Next(1, 1000000); 560 rootItem.inventoryNextPermissions = (uint)_rnd.Next(1, 1000000);
561 rootItem.inventoryID = LLUUID.Random(); 561 rootItem.inventoryID = LLUUID.Random();
562 rootItem.inventoryDescription = "Root item, Description"; 562 rootItem.inventoryDescription = "Root item, Description";
563 rootItem.inventoryName = "Root item"; 563 rootItem.inventoryName = "Root item";
564 rootItem.invType = _rnd.Next(1, 1000); 564 rootItem.invType = _rnd.Next(1, 1000);
565 rootItem.parentFolderID = root.folderID; 565 rootItem.parentFolderID = root.folderID;
566 _dbPlugin.addInventoryItem(rootItem); 566 _dbPlugin.addInventoryItem(rootItem);
567 567
568 InventoryItemBase child1Item = new InventoryItemBase(); 568 InventoryItemBase child1Item = new InventoryItemBase();
569 child1Item.assetID = LLUUID.Random(); 569 child1Item.assetID = LLUUID.Random();
570 child1Item.assetType = _rnd.Next(1, 1000); 570 child1Item.assetType = _rnd.Next(1, 1000);
571 child1Item.avatarID = _agent_1_id; 571 child1Item.avatarID = _agent_1_id;
572 child1Item.creatorsID = LLUUID.Random(); 572 child1Item.creatorsID = LLUUID.Random();
573 child1Item.inventoryBasePermissions = (uint)_rnd.Next(1, 1000000); 573 child1Item.inventoryBasePermissions = (uint)_rnd.Next(1, 1000000);
574 child1Item.inventoryCurrentPermissions = (uint)_rnd.Next(1, 1000000); 574 child1Item.inventoryCurrentPermissions = (uint)_rnd.Next(1, 1000000);
575 child1Item.inventoryEveryOnePermissions = (uint)_rnd.Next(1, 1000000); 575 child1Item.inventoryEveryOnePermissions = (uint)_rnd.Next(1, 1000000);
576 child1Item.inventoryNextPermissions = (uint)_rnd.Next(1, 1000000); 576 child1Item.inventoryNextPermissions = (uint)_rnd.Next(1, 1000000);
577 child1Item.inventoryID = LLUUID.Random(); 577 child1Item.inventoryID = LLUUID.Random();
578 child1Item.inventoryDescription = "child1 item, Description"; 578 child1Item.inventoryDescription = "child1 item, Description";
579 child1Item.inventoryName = "child1 item"; 579 child1Item.inventoryName = "child1 item";
580 child1Item.invType = _rnd.Next(1, 1000); 580 child1Item.invType = _rnd.Next(1, 1000);
581 child1Item.parentFolderID = child1.folderID; 581 child1Item.parentFolderID = child1.folderID;
582 _dbPlugin.addInventoryItem(child1Item); 582 _dbPlugin.addInventoryItem(child1Item);
583 583
584 InventoryItemBase child1ChildItem = new InventoryItemBase(); 584 InventoryItemBase child1ChildItem = new InventoryItemBase();
585 child1ChildItem.assetID = LLUUID.Random(); 585 child1ChildItem.assetID = LLUUID.Random();
586 child1ChildItem.assetType = _rnd.Next(1, 1000); 586 child1ChildItem.assetType = _rnd.Next(1, 1000);
587 child1ChildItem.avatarID = _agent_1_id; 587 child1ChildItem.avatarID = _agent_1_id;
588 child1ChildItem.creatorsID = LLUUID.Random(); 588 child1ChildItem.creatorsID = LLUUID.Random();
589 child1ChildItem.inventoryBasePermissions = (uint)_rnd.Next(1, 1000000); 589 child1ChildItem.inventoryBasePermissions = (uint)_rnd.Next(1, 1000000);
590 child1ChildItem.inventoryCurrentPermissions = (uint)_rnd.Next(1, 1000000); 590 child1ChildItem.inventoryCurrentPermissions = (uint)_rnd.Next(1, 1000000);
591 child1ChildItem.inventoryEveryOnePermissions = (uint)_rnd.Next(1, 1000000); 591 child1ChildItem.inventoryEveryOnePermissions = (uint)_rnd.Next(1, 1000000);
592 child1ChildItem.inventoryNextPermissions = (uint)_rnd.Next(1, 1000000); 592 child1ChildItem.inventoryNextPermissions = (uint)_rnd.Next(1, 1000000);
593 child1ChildItem.inventoryID = LLUUID.Random(); 593 child1ChildItem.inventoryID = LLUUID.Random();
594 child1ChildItem.inventoryDescription = "child1Child item, Description"; 594 child1ChildItem.inventoryDescription = "child1Child item, Description";
595 child1ChildItem.inventoryName = "child1Child item"; 595 child1ChildItem.inventoryName = "child1Child item";
596 child1ChildItem.invType = _rnd.Next(1, 1000); 596 child1ChildItem.invType = _rnd.Next(1, 1000);
597 child1ChildItem.parentFolderID = child1Child.folderID; 597 child1ChildItem.parentFolderID = child1Child.folderID;
598 _dbPlugin.addInventoryItem(child1ChildItem); 598 _dbPlugin.addInventoryItem(child1ChildItem);
599 599
600 InventoryItemBase child2Item = new InventoryItemBase(); 600 InventoryItemBase child2Item = new InventoryItemBase();
601 child2Item.assetID = LLUUID.Random(); 601 child2Item.assetID = LLUUID.Random();
602 child2Item.assetType = _rnd.Next(1, 1000); 602 child2Item.assetType = _rnd.Next(1, 1000);
603 child2Item.avatarID = _agent_1_id; 603 child2Item.avatarID = _agent_1_id;
604 child2Item.creatorsID = LLUUID.Random(); 604 child2Item.creatorsID = LLUUID.Random();
605 child2Item.inventoryBasePermissions = (uint)_rnd.Next(1, 1000000); 605 child2Item.inventoryBasePermissions = (uint)_rnd.Next(1, 1000000);
606 child2Item.inventoryCurrentPermissions = (uint)_rnd.Next(1, 1000000); 606 child2Item.inventoryCurrentPermissions = (uint)_rnd.Next(1, 1000000);
607 child2Item.inventoryEveryOnePermissions = (uint)_rnd.Next(1, 1000000); 607 child2Item.inventoryEveryOnePermissions = (uint)_rnd.Next(1, 1000000);
608 child2Item.inventoryNextPermissions = (uint)_rnd.Next(1, 1000000); 608 child2Item.inventoryNextPermissions = (uint)_rnd.Next(1, 1000000);
609 child2Item.inventoryID = LLUUID.Random(); 609 child2Item.inventoryID = LLUUID.Random();
610 child2Item.inventoryDescription = "child2 item, Description"; 610 child2Item.inventoryDescription = "child2 item, Description";
611 child2Item.inventoryName = "child2 item"; 611 child2Item.inventoryName = "child2 item";
612 child2Item.invType = _rnd.Next(1, 1000); 612 child2Item.invType = _rnd.Next(1, 1000);
613 child2Item.parentFolderID = child2.folderID; 613 child2Item.parentFolderID = child2.folderID;
614 _dbPlugin.addInventoryItem(child2Item); 614 _dbPlugin.addInventoryItem(child2Item);
615 615
616 InventoryItemBase child2ChildItem = new InventoryItemBase(); 616 InventoryItemBase child2ChildItem = new InventoryItemBase();
617 child2ChildItem.assetID = LLUUID.Random(); 617 child2ChildItem.assetID = LLUUID.Random();
618 child2ChildItem.assetType = _rnd.Next(1, 1000); 618 child2ChildItem.assetType = _rnd.Next(1, 1000);
619 child2ChildItem.avatarID = _agent_1_id; 619 child2ChildItem.avatarID = _agent_1_id;
620 child2ChildItem.creatorsID = LLUUID.Random(); 620 child2ChildItem.creatorsID = LLUUID.Random();
621 child2ChildItem.inventoryBasePermissions = (uint)_rnd.Next(1, 1000000); 621 child2ChildItem.inventoryBasePermissions = (uint)_rnd.Next(1, 1000000);
622 child2ChildItem.inventoryCurrentPermissions = (uint)_rnd.Next(1, 1000000); 622 child2ChildItem.inventoryCurrentPermissions = (uint)_rnd.Next(1, 1000000);
623 child2ChildItem.inventoryEveryOnePermissions = (uint)_rnd.Next(1, 1000000); 623 child2ChildItem.inventoryEveryOnePermissions = (uint)_rnd.Next(1, 1000000);
624 child2ChildItem.inventoryNextPermissions = (uint)_rnd.Next(1, 1000000); 624 child2ChildItem.inventoryNextPermissions = (uint)_rnd.Next(1, 1000000);
625 child2ChildItem.inventoryID = LLUUID.Random(); 625 child2ChildItem.inventoryID = LLUUID.Random();
626 child2ChildItem.inventoryDescription = "child2Child item, Description"; 626 child2ChildItem.inventoryDescription = "child2Child item, Description";
627 child2ChildItem.inventoryName = "child2Child item"; 627 child2ChildItem.inventoryName = "child2Child item";
628 child2ChildItem.invType = _rnd.Next(1, 1000); 628 child2ChildItem.invType = _rnd.Next(1, 1000);
629 child2ChildItem.parentFolderID = child2Child.folderID; 629 child2ChildItem.parentFolderID = child2Child.folderID;
630 _dbPlugin.addInventoryItem(child2ChildItem); 630 _dbPlugin.addInventoryItem(child2ChildItem);
631 631
632 // test deletetion of items 632 // test deletetion of items
633 633
634 _dbPlugin.deleteInventoryItem(rootItem.inventoryID); 634 _dbPlugin.deleteInventoryItem(rootItem.inventoryID);
635 _dbPlugin.deleteInventoryItem(child1Item.inventoryID); 635 _dbPlugin.deleteInventoryItem(child1Item.inventoryID);
636 _dbPlugin.deleteInventoryItem(child1ChildItem.inventoryID); 636 _dbPlugin.deleteInventoryItem(child1ChildItem.inventoryID);
637 _dbPlugin.deleteInventoryItem(child2Item.inventoryID); 637 _dbPlugin.deleteInventoryItem(child2Item.inventoryID);
638 _dbPlugin.deleteInventoryItem(child2ChildItem.inventoryID); 638 _dbPlugin.deleteInventoryItem(child2ChildItem.inventoryID);
639 639
640 InventoryItemBase item = _dbPlugin.getInventoryItem(rootItem.inventoryID); 640 InventoryItemBase item = _dbPlugin.getInventoryItem(rootItem.inventoryID);
641 Assert.IsNull(item); 641 Assert.IsNull(item);
642 642
643 item = _dbPlugin.getInventoryItem(child1Item.inventoryID); 643 item = _dbPlugin.getInventoryItem(child1Item.inventoryID);
644 Assert.IsNull(item); 644 Assert.IsNull(item);
645 645
646 item = _dbPlugin.getInventoryItem(child1ChildItem.inventoryID); 646 item = _dbPlugin.getInventoryItem(child1ChildItem.inventoryID);
647 Assert.IsNull(item); 647 Assert.IsNull(item);
648 648
649 item = _dbPlugin.getInventoryItem(child2Item.inventoryID); 649 item = _dbPlugin.getInventoryItem(child2Item.inventoryID);
650 Assert.IsNull(item); 650 Assert.IsNull(item);
651 651
652 item = _dbPlugin.getInventoryItem(child2ChildItem.inventoryID); 652 item = _dbPlugin.getInventoryItem(child2ChildItem.inventoryID);
653 Assert.IsNull(item); 653 Assert.IsNull(item);
654 654
655 _dbPlugin.deleteInventoryFolder(_agent_1_id); 655 _dbPlugin.deleteInventoryFolder(_agent_1_id);
656 } 656 }
657 657
658 658
659 /// <summary> 659 /// <summary>
660 /// Test that we can insert a root folder 660 /// Test that we can insert a root folder
661 /// </summary> 661 /// </summary>
662 [Test] 662 [Test]
663 public void T08_DeleteInventoryWithItems() 663 public void T08_DeleteInventoryWithItems()
664 { 664 {
665 665
666 // Setup inventory 666 // Setup inventory
667 InventoryFolderBase root = new InventoryFolderBase(); 667 InventoryFolderBase root = new InventoryFolderBase();
668 root.agentID = _agent_1_id; 668 root.agentID = _agent_1_id;
669 root.folderID = _agent_1_id; 669 root.folderID = _agent_1_id;
670 root.name = "Root folder"; 670 root.name = "Root folder";
671 root.parentID = LLUUID.Zero; 671 root.parentID = LLUUID.Zero;
672 root.type = 2; 672 root.type = 2;
673 root.version = 2; 673 root.version = 2;
674 _dbPlugin.addInventoryFolder(root); 674 _dbPlugin.addInventoryFolder(root);
675 675
676 InventoryFolderBase child1 = new InventoryFolderBase(); 676 InventoryFolderBase child1 = new InventoryFolderBase();
677 child1.agentID = _agent_1_id; 677 child1.agentID = _agent_1_id;
678 child1.folderID = LLUUID.Random(); 678 child1.folderID = LLUUID.Random();
679 child1.name = "Child 1"; 679 child1.name = "Child 1";
680 child1.parentID = root.folderID; 680 child1.parentID = root.folderID;
681 child1.type = 3; 681 child1.type = 3;
682 child1.version = 3; 682 child1.version = 3;
683 _dbPlugin.addInventoryFolder(child1); 683 _dbPlugin.addInventoryFolder(child1);
684 684
685 InventoryFolderBase child1Child = new InventoryFolderBase(); 685 InventoryFolderBase child1Child = new InventoryFolderBase();
686 child1Child.agentID = _agent_1_id; 686 child1Child.agentID = _agent_1_id;
687 child1Child.folderID = LLUUID.Random(); 687 child1Child.folderID = LLUUID.Random();
688 child1Child.name = "Child 1 child"; 688 child1Child.name = "Child 1 child";
689 child1Child.parentID = child1.folderID; 689 child1Child.parentID = child1.folderID;
690 child1Child.type = 4; 690 child1Child.type = 4;
691 child1Child.version = 4; 691 child1Child.version = 4;
692 _dbPlugin.addInventoryFolder(child1Child); 692 _dbPlugin.addInventoryFolder(child1Child);
693 693
694 InventoryFolderBase child2 = new InventoryFolderBase(); 694 InventoryFolderBase child2 = new InventoryFolderBase();
695 child2.agentID = _agent_1_id; 695 child2.agentID = _agent_1_id;
696 child2.folderID = LLUUID.Random(); 696 child2.folderID = LLUUID.Random();
697 child2.name = "Child 2"; 697 child2.name = "Child 2";
698 child2.parentID = root.folderID; 698 child2.parentID = root.folderID;
699 child2.type = 5; 699 child2.type = 5;
700 child2.version = 5; 700 child2.version = 5;
701 _dbPlugin.addInventoryFolder(child2); 701 _dbPlugin.addInventoryFolder(child2);
702 702
703 InventoryFolderBase child2Child = new InventoryFolderBase(); 703 InventoryFolderBase child2Child = new InventoryFolderBase();
704 child2Child.agentID = _agent_1_id; 704 child2Child.agentID = _agent_1_id;
705 child2Child.folderID = LLUUID.Random(); 705 child2Child.folderID = LLUUID.Random();
706 child2Child.name = "Child 2 child"; 706 child2Child.name = "Child 2 child";
707 child2Child.parentID = child2.folderID; 707 child2Child.parentID = child2.folderID;
708 child2Child.type = 6; 708 child2Child.type = 6;
709 child2Child.version = 6; 709 child2Child.version = 6;
710 _dbPlugin.addInventoryFolder(child2Child); 710 _dbPlugin.addInventoryFolder(child2Child);
711 711
712 InventoryItemBase rootItem = new InventoryItemBase(); 712 InventoryItemBase rootItem = new InventoryItemBase();
713 rootItem.assetID = LLUUID.Random(); 713 rootItem.assetID = LLUUID.Random();
714 rootItem.assetType = _rnd.Next(1, 1000); 714 rootItem.assetType = _rnd.Next(1, 1000);
715 rootItem.avatarID = _agent_1_id; 715 rootItem.avatarID = _agent_1_id;
716 rootItem.creatorsID = LLUUID.Random(); 716 rootItem.creatorsID = LLUUID.Random();
717 rootItem.inventoryBasePermissions = (uint)_rnd.Next(1, 1000000); 717 rootItem.inventoryBasePermissions = (uint)_rnd.Next(1, 1000000);
718 rootItem.inventoryCurrentPermissions = (uint)_rnd.Next(1, 1000000); 718 rootItem.inventoryCurrentPermissions = (uint)_rnd.Next(1, 1000000);
719 rootItem.inventoryEveryOnePermissions = (uint)_rnd.Next(1, 1000000); 719 rootItem.inventoryEveryOnePermissions = (uint)_rnd.Next(1, 1000000);
720 rootItem.inventoryNextPermissions = (uint)_rnd.Next(1, 1000000); 720 rootItem.inventoryNextPermissions = (uint)_rnd.Next(1, 1000000);
721 rootItem.inventoryID = LLUUID.Random(); 721 rootItem.inventoryID = LLUUID.Random();
722 rootItem.inventoryDescription = "Root item, Description"; 722 rootItem.inventoryDescription = "Root item, Description";
723 rootItem.inventoryName = "Root item"; 723 rootItem.inventoryName = "Root item";
724 rootItem.invType = _rnd.Next(1, 1000); 724 rootItem.invType = _rnd.Next(1, 1000);
725 rootItem.parentFolderID = root.folderID; 725 rootItem.parentFolderID = root.folderID;
726 _dbPlugin.addInventoryItem(rootItem); 726 _dbPlugin.addInventoryItem(rootItem);
727 727
728 InventoryItemBase child1Item = new InventoryItemBase(); 728 InventoryItemBase child1Item = new InventoryItemBase();
729 child1Item.assetID = LLUUID.Random(); 729 child1Item.assetID = LLUUID.Random();
730 child1Item.assetType = _rnd.Next(1, 1000); 730 child1Item.assetType = _rnd.Next(1, 1000);
731 child1Item.avatarID = _agent_1_id; 731 child1Item.avatarID = _agent_1_id;
732 child1Item.creatorsID = LLUUID.Random(); 732 child1Item.creatorsID = LLUUID.Random();
733 child1Item.inventoryBasePermissions = (uint)_rnd.Next(1, 1000000); 733 child1Item.inventoryBasePermissions = (uint)_rnd.Next(1, 1000000);
734 child1Item.inventoryCurrentPermissions = (uint)_rnd.Next(1, 1000000); 734 child1Item.inventoryCurrentPermissions = (uint)_rnd.Next(1, 1000000);
735 child1Item.inventoryEveryOnePermissions = (uint)_rnd.Next(1, 1000000); 735 child1Item.inventoryEveryOnePermissions = (uint)_rnd.Next(1, 1000000);
736 child1Item.inventoryNextPermissions = (uint)_rnd.Next(1, 1000000); 736 child1Item.inventoryNextPermissions = (uint)_rnd.Next(1, 1000000);
737 child1Item.inventoryID = LLUUID.Random(); 737 child1Item.inventoryID = LLUUID.Random();
738 child1Item.inventoryDescription = "child1 item, Description"; 738 child1Item.inventoryDescription = "child1 item, Description";
739 child1Item.inventoryName = "child1 item"; 739 child1Item.inventoryName = "child1 item";
740 child1Item.invType = _rnd.Next(1, 1000); 740 child1Item.invType = _rnd.Next(1, 1000);
741 child1Item.parentFolderID = child1.folderID; 741 child1Item.parentFolderID = child1.folderID;
742 _dbPlugin.addInventoryItem(child1Item); 742 _dbPlugin.addInventoryItem(child1Item);
743 743
744 InventoryItemBase child1ChildItem = new InventoryItemBase(); 744 InventoryItemBase child1ChildItem = new InventoryItemBase();
745 child1ChildItem.assetID = LLUUID.Random(); 745 child1ChildItem.assetID = LLUUID.Random();
746 child1ChildItem.assetType = _rnd.Next(1, 1000); 746 child1ChildItem.assetType = _rnd.Next(1, 1000);
747 child1ChildItem.avatarID = _agent_1_id; 747 child1ChildItem.avatarID = _agent_1_id;
748 child1ChildItem.creatorsID = LLUUID.Random(); 748 child1ChildItem.creatorsID = LLUUID.Random();
749 child1ChildItem.inventoryBasePermissions = (uint)_rnd.Next(1, 1000000); 749 child1ChildItem.inventoryBasePermissions = (uint)_rnd.Next(1, 1000000);
750 child1ChildItem.inventoryCurrentPermissions = (uint)_rnd.Next(1, 1000000); 750 child1ChildItem.inventoryCurrentPermissions = (uint)_rnd.Next(1, 1000000);
751 child1ChildItem.inventoryEveryOnePermissions = (uint)_rnd.Next(1, 1000000); 751 child1ChildItem.inventoryEveryOnePermissions = (uint)_rnd.Next(1, 1000000);
752 child1ChildItem.inventoryNextPermissions = (uint)_rnd.Next(1, 1000000); 752 child1ChildItem.inventoryNextPermissions = (uint)_rnd.Next(1, 1000000);
753 child1ChildItem.inventoryID = LLUUID.Random(); 753 child1ChildItem.inventoryID = LLUUID.Random();
754 child1ChildItem.inventoryDescription = "child1Child item, Description"; 754 child1ChildItem.inventoryDescription = "child1Child item, Description";
755 child1ChildItem.inventoryName = "child1Child item"; 755 child1ChildItem.inventoryName = "child1Child item";
756 child1ChildItem.invType = _rnd.Next(1, 1000); 756 child1ChildItem.invType = _rnd.Next(1, 1000);
757 child1ChildItem.parentFolderID = child1Child.folderID; 757 child1ChildItem.parentFolderID = child1Child.folderID;
758 _dbPlugin.addInventoryItem(child1ChildItem); 758 _dbPlugin.addInventoryItem(child1ChildItem);
759 759
760 InventoryItemBase child2Item = new InventoryItemBase(); 760 InventoryItemBase child2Item = new InventoryItemBase();
761 child2Item.assetID = LLUUID.Random(); 761 child2Item.assetID = LLUUID.Random();
762 child2Item.assetType = _rnd.Next(1, 1000); 762 child2Item.assetType = _rnd.Next(1, 1000);
763 child2Item.avatarID = _agent_1_id; 763 child2Item.avatarID = _agent_1_id;
764 child2Item.creatorsID = LLUUID.Random(); 764 child2Item.creatorsID = LLUUID.Random();
765 child2Item.inventoryBasePermissions = (uint)_rnd.Next(1, 1000000); 765 child2Item.inventoryBasePermissions = (uint)_rnd.Next(1, 1000000);
766 child2Item.inventoryCurrentPermissions = (uint)_rnd.Next(1, 1000000); 766 child2Item.inventoryCurrentPermissions = (uint)_rnd.Next(1, 1000000);
767 child2Item.inventoryEveryOnePermissions = (uint)_rnd.Next(1, 1000000); 767 child2Item.inventoryEveryOnePermissions = (uint)_rnd.Next(1, 1000000);
768 child2Item.inventoryNextPermissions = (uint)_rnd.Next(1, 1000000); 768 child2Item.inventoryNextPermissions = (uint)_rnd.Next(1, 1000000);
769 child2Item.inventoryID = LLUUID.Random(); 769 child2Item.inventoryID = LLUUID.Random();
770 child2Item.inventoryDescription = "child2 item, Description"; 770 child2Item.inventoryDescription = "child2 item, Description";
771 child2Item.inventoryName = "child2 item"; 771 child2Item.inventoryName = "child2 item";
772 child2Item.invType = _rnd.Next(1, 1000); 772 child2Item.invType = _rnd.Next(1, 1000);
773 child2Item.parentFolderID = child2.folderID; 773 child2Item.parentFolderID = child2.folderID;
774 _dbPlugin.addInventoryItem(child2Item); 774 _dbPlugin.addInventoryItem(child2Item);
775 775
776 InventoryItemBase child2ChildItem = new InventoryItemBase(); 776 InventoryItemBase child2ChildItem = new InventoryItemBase();
777 child2ChildItem.assetID = LLUUID.Random(); 777 child2ChildItem.assetID = LLUUID.Random();
778 child2ChildItem.assetType = _rnd.Next(1, 1000); 778 child2ChildItem.assetType = _rnd.Next(1, 1000);
779 child2ChildItem.avatarID = _agent_1_id; 779 child2ChildItem.avatarID = _agent_1_id;
780 child2ChildItem.creatorsID = LLUUID.Random(); 780 child2ChildItem.creatorsID = LLUUID.Random();
781 child2ChildItem.inventoryBasePermissions = (uint)_rnd.Next(1, 1000000); 781 child2ChildItem.inventoryBasePermissions = (uint)_rnd.Next(1, 1000000);
782 child2ChildItem.inventoryCurrentPermissions = (uint)_rnd.Next(1, 1000000); 782 child2ChildItem.inventoryCurrentPermissions = (uint)_rnd.Next(1, 1000000);
783 child2ChildItem.inventoryEveryOnePermissions = (uint)_rnd.Next(1, 1000000); 783 child2ChildItem.inventoryEveryOnePermissions = (uint)_rnd.Next(1, 1000000);
784 child2ChildItem.inventoryNextPermissions = (uint)_rnd.Next(1, 1000000); 784 child2ChildItem.inventoryNextPermissions = (uint)_rnd.Next(1, 1000000);
785 child2ChildItem.inventoryID = LLUUID.Random(); 785 child2ChildItem.inventoryID = LLUUID.Random();
786 child2ChildItem.inventoryDescription = "child2Child item, Description"; 786 child2ChildItem.inventoryDescription = "child2Child item, Description";
787 child2ChildItem.inventoryName = "child2Child item"; 787 child2ChildItem.inventoryName = "child2Child item";
788 child2ChildItem.invType = _rnd.Next(1, 1000); 788 child2ChildItem.invType = _rnd.Next(1, 1000);
789 child2ChildItem.parentFolderID = child2Child.folderID; 789 child2ChildItem.parentFolderID = child2Child.folderID;
790 _dbPlugin.addInventoryItem(child2ChildItem); 790 _dbPlugin.addInventoryItem(child2ChildItem);
791 791
792 // test deletetion of items 792 // test deletetion of items
793 793
794 _dbPlugin.deleteInventoryFolder(_agent_1_id); 794 _dbPlugin.deleteInventoryFolder(_agent_1_id);
795 795
796 InventoryItemBase item = _dbPlugin.getInventoryItem(rootItem.inventoryID); 796 InventoryItemBase item = _dbPlugin.getInventoryItem(rootItem.inventoryID);
797 Assert.IsNull(item); 797 Assert.IsNull(item);
798 798
799 item = _dbPlugin.getInventoryItem(child1Item.inventoryID); 799 item = _dbPlugin.getInventoryItem(child1Item.inventoryID);
800 Assert.IsNull(item); 800 Assert.IsNull(item);
801 801
802 item = _dbPlugin.getInventoryItem(child1ChildItem.inventoryID); 802 item = _dbPlugin.getInventoryItem(child1ChildItem.inventoryID);
803 Assert.IsNull(item); 803 Assert.IsNull(item);
804 804
805 item = _dbPlugin.getInventoryItem(child2Item.inventoryID); 805 item = _dbPlugin.getInventoryItem(child2Item.inventoryID);
806 Assert.IsNull(item); 806 Assert.IsNull(item);
807 807
808 item = _dbPlugin.getInventoryItem(child2ChildItem.inventoryID); 808 item = _dbPlugin.getInventoryItem(child2ChildItem.inventoryID);
809 Assert.IsNull(item); 809 Assert.IsNull(item);
810 810
811 } 811 }
812 812
813 /// <summary> 813 /// <summary>
814 /// Test that we can update items 814 /// Test that we can update items
815 /// </summary> 815 /// </summary>
816 [Test] 816 [Test]
817 public void T09_UpdateItem() 817 public void T09_UpdateItem()
818 { 818 {
819 819
820 // Setup inventory 820 // Setup inventory
821 InventoryFolderBase root = new InventoryFolderBase(); 821 InventoryFolderBase root = new InventoryFolderBase();
822 root.agentID = _agent_1_id; 822 root.agentID = _agent_1_id;
823 root.folderID = _agent_1_id; 823 root.folderID = _agent_1_id;
824 root.name = "Root folder"; 824 root.name = "Root folder";
825 root.parentID = LLUUID.Zero; 825 root.parentID = LLUUID.Zero;
826 root.type = 2; 826 root.type = 2;
827 root.version = 2; 827 root.version = 2;
828 _dbPlugin.addInventoryFolder(root); 828 _dbPlugin.addInventoryFolder(root);
829 829
830 InventoryItemBase rootItem = new InventoryItemBase(); 830 InventoryItemBase rootItem = new InventoryItemBase();
831 rootItem.assetID = LLUUID.Random(); 831 rootItem.assetID = LLUUID.Random();
832 rootItem.assetType = _rnd.Next(1, 1000); 832 rootItem.assetType = _rnd.Next(1, 1000);
833 rootItem.avatarID = _agent_1_id; 833 rootItem.avatarID = _agent_1_id;
834 rootItem.creatorsID = LLUUID.Random(); 834 rootItem.creatorsID = LLUUID.Random();
835 rootItem.inventoryBasePermissions = (uint)_rnd.Next(1, 1000000); 835 rootItem.inventoryBasePermissions = (uint)_rnd.Next(1, 1000000);
836 rootItem.inventoryCurrentPermissions = (uint)_rnd.Next(1, 1000000); 836 rootItem.inventoryCurrentPermissions = (uint)_rnd.Next(1, 1000000);
837 rootItem.inventoryEveryOnePermissions = (uint)_rnd.Next(1, 1000000); 837 rootItem.inventoryEveryOnePermissions = (uint)_rnd.Next(1, 1000000);
838 rootItem.inventoryNextPermissions = (uint)_rnd.Next(1, 1000000); 838 rootItem.inventoryNextPermissions = (uint)_rnd.Next(1, 1000000);
839 rootItem.inventoryID = LLUUID.Random(); 839 rootItem.inventoryID = LLUUID.Random();
840 rootItem.inventoryDescription = "Root item, Description"; 840 rootItem.inventoryDescription = "Root item, Description";
841 rootItem.inventoryName = "Root item"; 841 rootItem.inventoryName = "Root item";
842 rootItem.invType = _rnd.Next(1, 1000); 842 rootItem.invType = _rnd.Next(1, 1000);
843 rootItem.parentFolderID = root.folderID; 843 rootItem.parentFolderID = root.folderID;
844 _dbPlugin.addInventoryItem(rootItem); 844 _dbPlugin.addInventoryItem(rootItem);
845 845
846 rootItem.assetID = LLUUID.Random(); 846 rootItem.assetID = LLUUID.Random();
847 _dbPlugin.updateInventoryItem(rootItem); 847 _dbPlugin.updateInventoryItem(rootItem);
848 InventoryItemBase item = _dbPlugin.getInventoryItem(rootItem.inventoryID); 848 InventoryItemBase item = _dbPlugin.getInventoryItem(rootItem.inventoryID);
849 Assert.IsTrue(AreItemsIdentical(rootItem, item)); 849 Assert.IsTrue(AreItemsIdentical(rootItem, item));
850 850
851 rootItem.assetType = rootItem.assetType+1; 851 rootItem.assetType = rootItem.assetType+1;
852 _dbPlugin.updateInventoryItem(rootItem); 852 _dbPlugin.updateInventoryItem(rootItem);
853 item = _dbPlugin.getInventoryItem(rootItem.inventoryID); 853 item = _dbPlugin.getInventoryItem(rootItem.inventoryID);
854 Assert.IsTrue(AreItemsIdentical(rootItem, item)); 854 Assert.IsTrue(AreItemsIdentical(rootItem, item));
855 855
856 rootItem.avatarID = LLUUID.Random(); 856 rootItem.avatarID = LLUUID.Random();
857 _dbPlugin.updateInventoryItem(rootItem); 857 _dbPlugin.updateInventoryItem(rootItem);
858 item = _dbPlugin.getInventoryItem(rootItem.inventoryID); 858 item = _dbPlugin.getInventoryItem(rootItem.inventoryID);
859 Assert.IsTrue(AreItemsIdentical(rootItem, item)); 859 Assert.IsTrue(AreItemsIdentical(rootItem, item));
860 860
861 rootItem.creatorsID = LLUUID.Random(); 861 rootItem.creatorsID = LLUUID.Random();
862 _dbPlugin.updateInventoryItem(rootItem); 862 _dbPlugin.updateInventoryItem(rootItem);
863 item = _dbPlugin.getInventoryItem(rootItem.inventoryID); 863 item = _dbPlugin.getInventoryItem(rootItem.inventoryID);
864 Assert.IsTrue(AreItemsIdentical(rootItem, item)); 864 Assert.IsTrue(AreItemsIdentical(rootItem, item));
865 865
866 rootItem.inventoryBasePermissions = rootItem.inventoryBasePermissions+1; 866 rootItem.inventoryBasePermissions = rootItem.inventoryBasePermissions+1;
867 _dbPlugin.updateInventoryItem(rootItem); 867 _dbPlugin.updateInventoryItem(rootItem);
868 item = _dbPlugin.getInventoryItem(rootItem.inventoryID); 868 item = _dbPlugin.getInventoryItem(rootItem.inventoryID);
869 Assert.IsTrue(AreItemsIdentical(rootItem, item)); 869 Assert.IsTrue(AreItemsIdentical(rootItem, item));
870 870
871 rootItem.inventoryCurrentPermissions = rootItem.inventoryCurrentPermissions+1; 871 rootItem.inventoryCurrentPermissions = rootItem.inventoryCurrentPermissions+1;
872 _dbPlugin.updateInventoryItem(rootItem); 872 _dbPlugin.updateInventoryItem(rootItem);
873 item = _dbPlugin.getInventoryItem(rootItem.inventoryID); 873 item = _dbPlugin.getInventoryItem(rootItem.inventoryID);
874 Assert.IsTrue(AreItemsIdentical(rootItem, item)); 874 Assert.IsTrue(AreItemsIdentical(rootItem, item));
875 875
876 rootItem.inventoryDescription = "New description"; 876 rootItem.inventoryDescription = "New description";
877 _dbPlugin.updateInventoryItem(rootItem); 877 _dbPlugin.updateInventoryItem(rootItem);
878 item = _dbPlugin.getInventoryItem(rootItem.inventoryID); 878 item = _dbPlugin.getInventoryItem(rootItem.inventoryID);
879 Assert.IsTrue(AreItemsIdentical(rootItem, item)); 879 Assert.IsTrue(AreItemsIdentical(rootItem, item));
880 880
881 rootItem.inventoryEveryOnePermissions = rootItem.inventoryEveryOnePermissions+1; 881 rootItem.inventoryEveryOnePermissions = rootItem.inventoryEveryOnePermissions+1;
882 _dbPlugin.updateInventoryItem(rootItem); 882 _dbPlugin.updateInventoryItem(rootItem);
883 item = _dbPlugin.getInventoryItem(rootItem.inventoryID); 883 item = _dbPlugin.getInventoryItem(rootItem.inventoryID);
884 Assert.IsTrue(AreItemsIdentical(rootItem, item)); 884 Assert.IsTrue(AreItemsIdentical(rootItem, item));
885 885
886 rootItem.inventoryName = "New name"; 886 rootItem.inventoryName = "New name";
887 _dbPlugin.updateInventoryItem(rootItem); 887 _dbPlugin.updateInventoryItem(rootItem);
888 item = _dbPlugin.getInventoryItem(rootItem.inventoryID); 888 item = _dbPlugin.getInventoryItem(rootItem.inventoryID);
889 Assert.IsTrue(AreItemsIdentical(rootItem, item)); 889 Assert.IsTrue(AreItemsIdentical(rootItem, item));
890 890
891 rootItem.inventoryNextPermissions = rootItem.inventoryNextPermissions+1; 891 rootItem.inventoryNextPermissions = rootItem.inventoryNextPermissions+1;
892 _dbPlugin.updateInventoryItem(rootItem); 892 _dbPlugin.updateInventoryItem(rootItem);
893 item = _dbPlugin.getInventoryItem(rootItem.inventoryID); 893 item = _dbPlugin.getInventoryItem(rootItem.inventoryID);
894 Assert.IsTrue(AreItemsIdentical(rootItem, item)); 894 Assert.IsTrue(AreItemsIdentical(rootItem, item));
895 895
896 rootItem.invType = rootItem.invType+1; 896 rootItem.invType = rootItem.invType+1;
897 _dbPlugin.updateInventoryItem(rootItem); 897 _dbPlugin.updateInventoryItem(rootItem);
898 item = _dbPlugin.getInventoryItem(rootItem.inventoryID); 898 item = _dbPlugin.getInventoryItem(rootItem.inventoryID);
899 Assert.IsTrue(AreItemsIdentical(rootItem, item)); 899 Assert.IsTrue(AreItemsIdentical(rootItem, item));
900 900
901 rootItem.parentFolderID = LLUUID.Zero; 901 rootItem.parentFolderID = LLUUID.Zero;
902 _dbPlugin.updateInventoryItem(rootItem); 902 _dbPlugin.updateInventoryItem(rootItem);
903 item = _dbPlugin.getInventoryItem(rootItem.inventoryID); 903 item = _dbPlugin.getInventoryItem(rootItem.inventoryID);
904 Assert.IsTrue(AreItemsIdentical(rootItem, item)); 904 Assert.IsTrue(AreItemsIdentical(rootItem, item));
905 905
906 _dbPlugin.deleteInventoryFolder(_agent_1_id); 906 _dbPlugin.deleteInventoryFolder(_agent_1_id);
907 _dbPlugin.deleteInventoryItem(rootItem.inventoryID); 907 _dbPlugin.deleteInventoryItem(rootItem.inventoryID);
908 } 908 }
909 909
910 910
911 /// <summary> 911 /// <summary>
912 /// Test that we can insert a root folder 912 /// Test that we can insert a root folder
913 /// </summary> 913 /// </summary>
914 [Test] 914 [Test]
915 public void T10_GetListOfItemsInFolder() 915 public void T10_GetListOfItemsInFolder()
916 { 916 {
917 917
918 // Setup inventory 918 // Setup inventory
919 InventoryFolderBase root = new InventoryFolderBase(); 919 InventoryFolderBase root = new InventoryFolderBase();
920 root.agentID = _agent_1_id; 920 root.agentID = _agent_1_id;
921 root.folderID = _agent_1_id; 921 root.folderID = _agent_1_id;
922 root.name = "Root folder"; 922 root.name = "Root folder";
923 root.parentID = LLUUID.Zero; 923 root.parentID = LLUUID.Zero;
924 root.type = 2; 924 root.type = 2;
925 root.version = 2; 925 root.version = 2;
926 _dbPlugin.addInventoryFolder(root); 926 _dbPlugin.addInventoryFolder(root);
927 927
928 InventoryFolderBase child1 = new InventoryFolderBase(); 928 InventoryFolderBase child1 = new InventoryFolderBase();
929 child1.agentID = _agent_1_id; 929 child1.agentID = _agent_1_id;
930 child1.folderID = LLUUID.Random(); 930 child1.folderID = LLUUID.Random();
931 child1.name = "Child 1"; 931 child1.name = "Child 1";
932 child1.parentID = root.folderID; 932 child1.parentID = root.folderID;
933 child1.type = 3; 933 child1.type = 3;
934 child1.version = 3; 934 child1.version = 3;
935 _dbPlugin.addInventoryFolder(child1); 935 _dbPlugin.addInventoryFolder(child1);
936 936
937 InventoryFolderBase child1Child = new InventoryFolderBase(); 937 InventoryFolderBase child1Child = new InventoryFolderBase();
938 child1Child.agentID = _agent_1_id; 938 child1Child.agentID = _agent_1_id;
939 child1Child.folderID = LLUUID.Random(); 939 child1Child.folderID = LLUUID.Random();
940 child1Child.name = "Child 1 child"; 940 child1Child.name = "Child 1 child";
941 child1Child.parentID = child1.folderID; 941 child1Child.parentID = child1.folderID;
942 child1Child.type = 4; 942 child1Child.type = 4;
943 child1Child.version = 4; 943 child1Child.version = 4;
944 _dbPlugin.addInventoryFolder(child1Child); 944 _dbPlugin.addInventoryFolder(child1Child);
945 945
946 946
947 InventoryItemBase item1 = new InventoryItemBase(); 947 InventoryItemBase item1 = new InventoryItemBase();
948 item1.assetID = LLUUID.Random(); 948 item1.assetID = LLUUID.Random();
949 item1.assetType = _rnd.Next(1, 1000); 949 item1.assetType = _rnd.Next(1, 1000);
950 item1.avatarID = _agent_1_id; 950 item1.avatarID = _agent_1_id;
951 item1.creatorsID = LLUUID.Random(); 951 item1.creatorsID = LLUUID.Random();
952 item1.inventoryBasePermissions = (uint)_rnd.Next(1, 1000000); 952 item1.inventoryBasePermissions = (uint)_rnd.Next(1, 1000000);
953 item1.inventoryCurrentPermissions = (uint)_rnd.Next(1, 1000000); 953 item1.inventoryCurrentPermissions = (uint)_rnd.Next(1, 1000000);
954 item1.inventoryEveryOnePermissions = (uint)_rnd.Next(1, 1000000); 954 item1.inventoryEveryOnePermissions = (uint)_rnd.Next(1, 1000000);
955 item1.inventoryNextPermissions = (uint)_rnd.Next(1, 1000000); 955 item1.inventoryNextPermissions = (uint)_rnd.Next(1, 1000000);
956 item1.inventoryID = LLUUID.Random(); 956 item1.inventoryID = LLUUID.Random();
957 item1.inventoryDescription = "Item 1, description"; 957 item1.inventoryDescription = "Item 1, description";
958 item1.inventoryName = "Item 1"; 958 item1.inventoryName = "Item 1";
959 item1.invType = _rnd.Next(1, 1000); 959 item1.invType = _rnd.Next(1, 1000);
960 item1.parentFolderID = child1Child.folderID; 960 item1.parentFolderID = child1Child.folderID;
961 _dbPlugin.addInventoryItem(item1); 961 _dbPlugin.addInventoryItem(item1);
962 962
963 InventoryItemBase item2 = new InventoryItemBase(); 963 InventoryItemBase item2 = new InventoryItemBase();
964 item2.assetID = LLUUID.Random(); 964 item2.assetID = LLUUID.Random();
965 item2.assetType = _rnd.Next(1, 1000); 965 item2.assetType = _rnd.Next(1, 1000);
966 item2.avatarID = _agent_1_id; 966 item2.avatarID = _agent_1_id;
967 item2.creatorsID = LLUUID.Random(); 967 item2.creatorsID = LLUUID.Random();
968 item2.inventoryBasePermissions = (uint)_rnd.Next(1, 1000000); 968 item2.inventoryBasePermissions = (uint)_rnd.Next(1, 1000000);
969 item2.inventoryCurrentPermissions = (uint)_rnd.Next(1, 1000000); 969 item2.inventoryCurrentPermissions = (uint)_rnd.Next(1, 1000000);
970 item2.inventoryEveryOnePermissions = (uint)_rnd.Next(1, 1000000); 970 item2.inventoryEveryOnePermissions = (uint)_rnd.Next(1, 1000000);
971 item2.inventoryNextPermissions = (uint)_rnd.Next(1, 1000000); 971 item2.inventoryNextPermissions = (uint)_rnd.Next(1, 1000000);
972 item2.inventoryID = LLUUID.Random(); 972 item2.inventoryID = LLUUID.Random();
973 item2.inventoryDescription = "Item 1, description"; 973 item2.inventoryDescription = "Item 1, description";
974 item2.inventoryName = "Item 1"; 974 item2.inventoryName = "Item 1";
975 item2.invType = _rnd.Next(1, 1000); 975 item2.invType = _rnd.Next(1, 1000);
976 item2.parentFolderID = child1Child.folderID; 976 item2.parentFolderID = child1Child.folderID;
977 _dbPlugin.addInventoryItem(item2); 977 _dbPlugin.addInventoryItem(item2);
978 978
979 List<InventoryItemBase> items = _dbPlugin.getInventoryInFolder(child1Child.folderID); 979 List<InventoryItemBase> items = _dbPlugin.getInventoryInFolder(child1Child.folderID);
980 Assert.IsNotNull(items); 980 Assert.IsNotNull(items);
981 Assert.IsNotEmpty(items); 981 Assert.IsNotEmpty(items);
982 982
983 bool foundItem1 = false; 983 bool foundItem1 = false;
984 bool foundItem2 = false; 984 bool foundItem2 = false;
985 985
986 foreach (InventoryItemBase i in items) 986 foreach (InventoryItemBase i in items)
987 { 987 {
988 if (i.inventoryID == item1.inventoryID) 988 if (i.inventoryID == item1.inventoryID)
989 { 989 {
990 foundItem1 = true; 990 foundItem1 = true;
991 Assert.IsTrue(AreItemsIdentical(item1, i)); 991 Assert.IsTrue(AreItemsIdentical(item1, i));
992 } 992 }
993 else if (i.inventoryID == item2.inventoryID) 993 else if (i.inventoryID == item2.inventoryID)
994 { 994 {
995 foundItem2 = true; 995 foundItem2 = true;
996 Assert.IsTrue(AreItemsIdentical(item2, i)); 996 Assert.IsTrue(AreItemsIdentical(item2, i));
997 } 997 }
998 else 998 else
999 { 999 {
1000 Assert.Fail("Unknown inventory item found"); 1000 Assert.Fail("Unknown inventory item found");
1001 } 1001 }
1002 } 1002 }
1003 1003
1004 Assert.IsTrue(foundItem1 && foundItem2, "not all items were returned"); 1004 Assert.IsTrue(foundItem1 && foundItem2, "not all items were returned");
1005 _dbPlugin.deleteInventoryFolder(_agent_1_id); 1005 _dbPlugin.deleteInventoryFolder(_agent_1_id);
1006 } 1006 }
1007 } 1007 }
1008} 1008}