aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services
diff options
context:
space:
mode:
authorubit2012-12-03 21:26:36 +0100
committerubit2012-12-03 21:26:36 +0100
commit5d4b7d537d872d27c394402d3483c2a9bd2153f0 (patch)
tree39aae50386555bf024700314fb7bee5121a9d683 /OpenSim/Services
parentMerge branch 'ubitwork' of ssh://3dhosting.de/var/git/careminster into ubitwork (diff)
parentMerge branch 'avination' into ubitwork (diff)
downloadopensim-SC-5d4b7d537d872d27c394402d3483c2a9bd2153f0.zip
opensim-SC-5d4b7d537d872d27c394402d3483c2a9bd2153f0.tar.gz
opensim-SC-5d4b7d537d872d27c394402d3483c2a9bd2153f0.tar.bz2
opensim-SC-5d4b7d537d872d27c394402d3483c2a9bd2153f0.tar.xz
Merge branch 'ubitwork' of ssh://3dhosting.de/var/git/careminster into ubitwork
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/Pool.cs (renamed from OpenSim/Services/InventoryService/InventoryServiceBase.cs)89
-rw-r--r--OpenSim/Services/AssetService/AssetService.cs17
-rw-r--r--OpenSim/Services/AssetService/AssetServiceBase.cs4
-rw-r--r--OpenSim/Services/AssetService/Properties/AssemblyInfo.cs33
-rw-r--r--OpenSim/Services/AssetService/XAssetService.cs18
-rw-r--r--OpenSim/Services/AuthenticationService/Properties/AssemblyInfo.cs33
-rw-r--r--OpenSim/Services/AuthorizationService/Properties/AssemblyInfo.cs33
-rw-r--r--OpenSim/Services/AvatarService/Properties/AssemblyInfo.cs33
-rw-r--r--OpenSim/Services/Base/Properties/AssemblyInfo.cs33
-rw-r--r--OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs8
-rw-r--r--OpenSim/Services/Connectors/Friends/FriendsSimConnector.cs6
-rw-r--r--OpenSim/Services/Connectors/GridUser/GridUserServicesConnector.cs9
-rw-r--r--OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs2
-rw-r--r--OpenSim/Services/Connectors/Neighbour/NeighbourServicesConnector.cs8
-rw-r--r--OpenSim/Services/Connectors/Properties/AssemblyInfo.cs33
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs2
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs2
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs2
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs8
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs3
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs2
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianProfiles.cs2
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs2
-rw-r--r--OpenSim/Services/FreeswitchService/Properties/AssemblyInfo.cs33
-rw-r--r--OpenSim/Services/Friends/Properties/AssemblyInfo.cs33
-rw-r--r--OpenSim/Services/GridService/GridService.cs99
-rw-r--r--OpenSim/Services/GridService/HypergridLinker.cs6
-rw-r--r--OpenSim/Services/GridService/Properties/AssemblyInfo.cs33
-rw-r--r--OpenSim/Services/HypergridService/GatekeeperService.cs116
-rw-r--r--OpenSim/Services/HypergridService/HGAssetService.cs26
-rw-r--r--OpenSim/Services/HypergridService/HGFriendsService.cs2
-rw-r--r--OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs76
-rw-r--r--OpenSim/Services/HypergridService/Properties/AssemblyInfo.cs33
-rw-r--r--OpenSim/Services/HypergridService/UserAgentService.cs105
-rw-r--r--OpenSim/Services/Interfaces/IAssetService.cs6
-rw-r--r--OpenSim/Services/Interfaces/IGridService.cs13
-rw-r--r--OpenSim/Services/Interfaces/IGridUserService.cs3
-rw-r--r--OpenSim/Services/Interfaces/IPresenceService.cs38
-rw-r--r--OpenSim/Services/Interfaces/Properties/AssemblyInfo.cs33
-rw-r--r--OpenSim/Services/InventoryService/InventoryService.cs700
-rw-r--r--OpenSim/Services/InventoryService/Properties/AssemblyInfo.cs33
-rw-r--r--OpenSim/Services/InventoryService/Tests/XInventoryServiceTests.cs177
-rw-r--r--OpenSim/Services/InventoryService/XInventoryService.cs116
-rw-r--r--OpenSim/Services/LLLoginService/LLLoginService.cs2
-rw-r--r--OpenSim/Services/LLLoginService/Properties/AssemblyInfo.cs33
-rw-r--r--OpenSim/Services/MapImageService/Properties/AssemblyInfo.cs33
-rw-r--r--OpenSim/Services/PresenceService/Properties/AssemblyInfo.cs33
-rw-r--r--OpenSim/Services/UserAccountService/GridUserService.cs13
-rw-r--r--OpenSim/Services/UserAccountService/Properties/AssemblyInfo.cs33
49 files changed, 1293 insertions, 917 deletions
diff --git a/OpenSim/Services/InventoryService/InventoryServiceBase.cs b/OpenSim/Framework/Pool.cs
index 456e455..5484f5c 100644
--- a/OpenSim/Services/InventoryService/InventoryServiceBase.cs
+++ b/OpenSim/Framework/Pool.cs
@@ -27,56 +27,65 @@
27 27
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Reflection;
31using Nini.Config;
32using OpenSim.Framework;
33using OpenSim.Data;
34using OpenSim.Services.Interfaces;
35using OpenSim.Services.Base;
36 30
37namespace OpenSim.Services.InventoryService 31namespace OpenSim.Framework
38{ 32{
39 public class InventoryServiceBase : ServiceBase 33 /// <summary>
34 /// Naive pool implementation.
35 /// </summary>
36 /// <remarks>
37 /// Currently assumes that objects are in a useable state when returned.
38 /// </remarks>
39 public class Pool<T>
40 { 40 {
41 protected IInventoryDataPlugin m_Database = null; 41 /// <summary>
42 42 /// Number of objects in the pool.
43 public InventoryServiceBase(IConfigSource config) : base(config) 43 /// </summary>
44 public int Count
44 { 45 {
45 string dllName = String.Empty; 46 get
46 string connString = String.Empty;
47
48 //
49 // Try reading the [DatabaseService] section first, if it exists
50 //
51 IConfig dbConfig = config.Configs["DatabaseService"];
52 if (dbConfig != null)
53 { 47 {
54 dllName = dbConfig.GetString("StorageProvider", String.Empty); 48 lock (m_pool)
55 connString = dbConfig.GetString("ConnectionString", String.Empty); 49 return m_pool.Count;
56 } 50 }
51 }
57 52
58 // 53 private Stack<T> m_pool;
59 // Try reading the more specific [InventoryService] section, if it exists
60 //
61 IConfig inventoryConfig = config.Configs["InventoryService"];
62 if (inventoryConfig != null)
63 {
64 dllName = inventoryConfig.GetString("StorageProvider", dllName);
65 connString = inventoryConfig.GetString("ConnectionString", connString);
66 }
67 54
68 // 55 /// <summary>
69 // We tried, but this doesn't exist. We can't proceed. 56 /// Maximum pool size. Beyond this, any returned objects are not pooled.
70 // 57 /// </summary>
71 if (dllName.Equals(String.Empty)) 58 private int m_maxPoolSize;
72 throw new Exception("No InventoryService configuration");
73 59
74 m_Database = LoadPlugin<IInventoryDataPlugin>(dllName); 60 private Func<T> m_createFunction;
75 if (m_Database == null)
76 throw new Exception("Could not find a storage interface in the given module");
77 61
78 m_Database.Initialise(connString); 62 public Pool(Func<T> createFunction, int maxSize)
63 {
64 m_maxPoolSize = maxSize;
65 m_createFunction = createFunction;
66 m_pool = new Stack<T>(m_maxPoolSize);
79 } 67 }
80 68
69 public T GetObject()
70 {
71 lock (m_pool)
72 {
73 if (m_pool.Count > 0)
74 return m_pool.Pop();
75 else
76 return m_createFunction();
77 }
78 }
79
80 public void ReturnObject(T obj)
81 {
82 lock (m_pool)
83 {
84 if (m_pool.Count >= m_maxPoolSize)
85 return;
86 else
87 m_pool.Push(obj);
88 }
89 }
81 } 90 }
82} 91} \ No newline at end of file
diff --git a/OpenSim/Services/AssetService/AssetService.cs b/OpenSim/Services/AssetService/AssetService.cs
index 96b430d..f1bffa4 100644
--- a/OpenSim/Services/AssetService/AssetService.cs
+++ b/OpenSim/Services/AssetService/AssetService.cs
@@ -70,7 +70,7 @@ namespace OpenSim.Services.AssetService
70 70
71 if (assetLoaderEnabled) 71 if (assetLoaderEnabled)
72 { 72 {
73 m_log.DebugFormat("[ASSET]: Loading default asset set from {0}", loaderArgs); 73 m_log.DebugFormat("[ASSET SERVICE]: Loading default asset set from {0}", loaderArgs);
74 74
75 m_AssetLoader.ForEachDefaultXmlAsset( 75 m_AssetLoader.ForEachDefaultXmlAsset(
76 loaderArgs, 76 loaderArgs,
@@ -200,20 +200,7 @@ namespace OpenSim.Services.AssetService
200 if (!UUID.TryParse(id, out assetID)) 200 if (!UUID.TryParse(id, out assetID))
201 return false; 201 return false;
202 202
203 AssetBase asset = m_Database.GetAsset(assetID); 203 return m_Database.Delete(id);
204 if (asset == null)
205 return false;
206
207 if ((int)(asset.Flags & AssetFlags.Maptile) != 0)
208 {
209 return m_Database.Delete(id);
210 }
211 else
212 {
213 m_log.DebugFormat("[ASSET SERVICE]: Request to delete asset {0}, but flags are not Maptile", id);
214 }
215
216 return false;
217 } 204 }
218 } 205 }
219} \ No newline at end of file 206} \ No newline at end of file
diff --git a/OpenSim/Services/AssetService/AssetServiceBase.cs b/OpenSim/Services/AssetService/AssetServiceBase.cs
index 177c565..58ab052 100644
--- a/OpenSim/Services/AssetService/AssetServiceBase.cs
+++ b/OpenSim/Services/AssetService/AssetServiceBase.cs
@@ -84,7 +84,7 @@ namespace OpenSim.Services.AssetService
84 84
85 m_Database = LoadPlugin<IAssetDataPlugin>(dllName); 85 m_Database = LoadPlugin<IAssetDataPlugin>(dllName);
86 if (m_Database == null) 86 if (m_Database == null)
87 throw new Exception("Could not find a storage interface in the given module"); 87 throw new Exception(string.Format("Could not find a storage interface in the module {0}", dllName));
88 88
89 m_Database.Initialise(connString); 89 m_Database.Initialise(connString);
90 90
@@ -96,7 +96,7 @@ namespace OpenSim.Services.AssetService
96 m_AssetLoader = LoadPlugin<IAssetLoader>(loaderName); 96 m_AssetLoader = LoadPlugin<IAssetLoader>(loaderName);
97 97
98 if (m_AssetLoader == null) 98 if (m_AssetLoader == null)
99 throw new Exception("Asset loader could not be loaded"); 99 throw new Exception(string.Format("Asset loader could not be loaded from {0}", loaderName));
100 } 100 }
101 } 101 }
102 } 102 }
diff --git a/OpenSim/Services/AssetService/Properties/AssemblyInfo.cs b/OpenSim/Services/AssetService/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..1509400
--- /dev/null
+++ b/OpenSim/Services/AssetService/Properties/AssemblyInfo.cs
@@ -0,0 +1,33 @@
1using System.Reflection;
2using System.Runtime.CompilerServices;
3using System.Runtime.InteropServices;
4
5// General Information about an assembly is controlled through the following
6// set of attributes. Change these attribute values to modify the information
7// associated with an assembly.
8[assembly: AssemblyTitle("OpenSim.Services.AssetService")]
9[assembly: AssemblyDescription("")]
10[assembly: AssemblyConfiguration("")]
11[assembly: AssemblyCompany("http://opensimulator.org")]
12[assembly: AssemblyProduct("OpenSim")]
13[assembly: AssemblyCopyright("OpenSimulator developers")]
14[assembly: AssemblyTrademark("")]
15[assembly: AssemblyCulture("")]
16
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
19// COM, set the ComVisible attribute to true on that type.
20[assembly: ComVisible(false)]
21
22// The following GUID is for the ID of the typelib if this project is exposed to COM
23[assembly: Guid("fe57c0df-6101-4c23-ae1a-7b3e937843f9")]
24
25// Version information for an assembly consists of the following four values:
26//
27// Major Version
28// Minor Version
29// Build Number
30// Revision
31//
32[assembly: AssemblyVersion("0.7.5.*")]
33[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenSim/Services/AssetService/XAssetService.cs b/OpenSim/Services/AssetService/XAssetService.cs
index e62bcb5..a1d10ed 100644
--- a/OpenSim/Services/AssetService/XAssetService.cs
+++ b/OpenSim/Services/AssetService/XAssetService.cs
@@ -194,21 +194,7 @@ namespace OpenSim.Services.AssetService
194 if (!UUID.TryParse(id, out assetID)) 194 if (!UUID.TryParse(id, out assetID))
195 return false; 195 return false;
196 196
197 AssetBase asset = m_Database.GetAsset(assetID); 197 return m_Database.Delete(id);
198 if (asset == null)
199 return false;
200
201 if ((int)(asset.Flags & AssetFlags.Maptile) != 0)
202 {
203 return m_Database.Delete(id);
204 }
205 else
206 {
207 m_log.DebugFormat("[XASSET SERVICE]: Request to delete asset {0}, but flags are not Maptile", id);
208 }
209
210 return false;
211 } 198 }
212 } 199 }
213} 200} \ No newline at end of file
214
diff --git a/OpenSim/Services/AuthenticationService/Properties/AssemblyInfo.cs b/OpenSim/Services/AuthenticationService/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..0eb2ba7
--- /dev/null
+++ b/OpenSim/Services/AuthenticationService/Properties/AssemblyInfo.cs
@@ -0,0 +1,33 @@
1using System.Reflection;
2using System.Runtime.CompilerServices;
3using System.Runtime.InteropServices;
4
5// General Information about an assembly is controlled through the following
6// set of attributes. Change these attribute values to modify the information
7// associated with an assembly.
8[assembly: AssemblyTitle("OpenSim.Services.AuthenticationService")]
9[assembly: AssemblyDescription("")]
10[assembly: AssemblyConfiguration("")]
11[assembly: AssemblyCompany("http://opensimulator.org")]
12[assembly: AssemblyProduct("OpenSim")]
13[assembly: AssemblyCopyright("Copyright © 2012")]
14[assembly: AssemblyTrademark("")]
15[assembly: AssemblyCulture("")]
16
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
19// COM, set the ComVisible attribute to true on that type.
20[assembly: ComVisible(false)]
21
22// The following GUID is for the ID of the typelib if this project is exposed to COM
23[assembly: Guid("74497b6f-8844-4ed4-8f0d-2caf7f42b760")]
24
25// Version information for an assembly consists of the following four values:
26//
27// Major Version
28// Minor Version
29// Build Number
30// Revision
31//
32[assembly: AssemblyVersion("0.7.5.*")]
33[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenSim/Services/AuthorizationService/Properties/AssemblyInfo.cs b/OpenSim/Services/AuthorizationService/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..6d6b11e
--- /dev/null
+++ b/OpenSim/Services/AuthorizationService/Properties/AssemblyInfo.cs
@@ -0,0 +1,33 @@
1using System.Reflection;
2using System.Runtime.CompilerServices;
3using System.Runtime.InteropServices;
4
5// General Information about an assembly is controlled through the following
6// set of attributes. Change these attribute values to modify the information
7// associated with an assembly.
8[assembly: AssemblyTitle("OpenSim.Services.AuthorizationService")]
9[assembly: AssemblyDescription("")]
10[assembly: AssemblyConfiguration("")]
11[assembly: AssemblyCompany("http://opensimulator.org")]
12[assembly: AssemblyProduct("OpenSim")]
13[assembly: AssemblyCopyright("OpenSimulator developers")]
14[assembly: AssemblyTrademark("")]
15[assembly: AssemblyCulture("")]
16
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
19// COM, set the ComVisible attribute to true on that type.
20[assembly: ComVisible(false)]
21
22// The following GUID is for the ID of the typelib if this project is exposed to COM
23[assembly: Guid("822586bb-cf25-4a2a-ac3e-59edaf147be3")]
24
25// Version information for an assembly consists of the following four values:
26//
27// Major Version
28// Minor Version
29// Build Number
30// Revision
31//
32[assembly: AssemblyVersion("0.7.5.*")]
33[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenSim/Services/AvatarService/Properties/AssemblyInfo.cs b/OpenSim/Services/AvatarService/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..0944149
--- /dev/null
+++ b/OpenSim/Services/AvatarService/Properties/AssemblyInfo.cs
@@ -0,0 +1,33 @@
1using System.Reflection;
2using System.Runtime.CompilerServices;
3using System.Runtime.InteropServices;
4
5// General Information about an assembly is controlled through the following
6// set of attributes. Change these attribute values to modify the information
7// associated with an assembly.
8[assembly: AssemblyTitle("OpenSim.Services.AvatarService")]
9[assembly: AssemblyDescription("")]
10[assembly: AssemblyConfiguration("")]
11[assembly: AssemblyCompany("http://opensimulator.org")]
12[assembly: AssemblyProduct("OpenSim")]
13[assembly: AssemblyCopyright("OpenSimulator developers")]
14[assembly: AssemblyTrademark("")]
15[assembly: AssemblyCulture("")]
16
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
19// COM, set the ComVisible attribute to true on that type.
20[assembly: ComVisible(false)]
21
22// The following GUID is for the ID of the typelib if this project is exposed to COM
23[assembly: Guid("0c9462ad-a5f3-46d1-ae9e-d6901fa33aa4")]
24
25// Version information for an assembly consists of the following four values:
26//
27// Major Version
28// Minor Version
29// Build Number
30// Revision
31//
32[assembly: AssemblyVersion("0.7.5.*")]
33[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenSim/Services/Base/Properties/AssemblyInfo.cs b/OpenSim/Services/Base/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..306b699
--- /dev/null
+++ b/OpenSim/Services/Base/Properties/AssemblyInfo.cs
@@ -0,0 +1,33 @@
1using System.Reflection;
2using System.Runtime.CompilerServices;
3using System.Runtime.InteropServices;
4
5// General Information about an assembly is controlled through the following
6// set of attributes. Change these attribute values to modify the information
7// associated with an assembly.
8[assembly: AssemblyTitle("OpenSim.Services.Base")]
9[assembly: AssemblyDescription("")]
10[assembly: AssemblyConfiguration("")]
11[assembly: AssemblyCompany("http://opensimulator.org")]
12[assembly: AssemblyProduct("OpenSim")]
13[assembly: AssemblyCopyright("OpenSimulator developers")]
14[assembly: AssemblyTrademark("")]
15[assembly: AssemblyCulture("")]
16
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
19// COM, set the ComVisible attribute to true on that type.
20[assembly: ComVisible(false)]
21
22// The following GUID is for the ID of the typelib if this project is exposed to COM
23[assembly: Guid("db9f6f73-3a56-497f-a465-4bea9cb86062")]
24
25// Version information for an assembly consists of the following four values:
26//
27// Major Version
28// Minor Version
29// Build Number
30// Revision
31//
32[assembly: AssemblyVersion("0.7.5.*")]
33[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs b/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs
index 7f32ad3..4b502b7 100644
--- a/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs
+++ b/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs
@@ -52,6 +52,8 @@ namespace OpenSim.Services.Connectors
52 private int m_retryCounter; 52 private int m_retryCounter;
53 private Dictionary<int, List<AssetBase>> m_retryQueue = new Dictionary<int, List<AssetBase>>(); 53 private Dictionary<int, List<AssetBase>> m_retryQueue = new Dictionary<int, List<AssetBase>>();
54 private System.Timers.Timer m_retryTimer; 54 private System.Timers.Timer m_retryTimer;
55 private int m_maxAssetRequestConcurrency = 30;
56
55 private delegate void AssetRetrievedEx(AssetBase asset); 57 private delegate void AssetRetrievedEx(AssetBase asset);
56 58
57 // Keeps track of concurrent requests for the same asset, so that it's only loaded once. 59 // Keeps track of concurrent requests for the same asset, so that it's only loaded once.
@@ -80,6 +82,10 @@ namespace OpenSim.Services.Connectors
80 82
81 public virtual void Initialise(IConfigSource source) 83 public virtual void Initialise(IConfigSource source)
82 { 84 {
85 IConfig netconfig = source.Configs["Network"];
86 if (netconfig != null)
87 m_maxAssetRequestConcurrency = netconfig.GetInt("MaxRequestConcurrency",m_maxAssetRequestConcurrency);
88
83 IConfig assetConfig = source.Configs["AssetService"]; 89 IConfig assetConfig = source.Configs["AssetService"];
84 if (assetConfig == null) 90 if (assetConfig == null)
85 { 91 {
@@ -204,7 +210,7 @@ namespace OpenSim.Services.Connectors
204 if (asset == null || asset.Data == null || asset.Data.Length == 0) 210 if (asset == null || asset.Data == null || asset.Data.Length == 0)
205 { 211 {
206 asset = SynchronousRestObjectRequester. 212 asset = SynchronousRestObjectRequester.
207 MakeRequest<int, AssetBase>("GET", uri, 0, 30); 213 MakeRequest<int, AssetBase>("GET", uri, 0, m_maxAssetRequestConcurrency);
208 214
209 if (m_Cache != null) 215 if (m_Cache != null)
210 m_Cache.Cache(asset); 216 m_Cache.Cache(asset);
diff --git a/OpenSim/Services/Connectors/Friends/FriendsSimConnector.cs b/OpenSim/Services/Connectors/Friends/FriendsSimConnector.cs
index 6cd21d1..45f4514 100644
--- a/OpenSim/Services/Connectors/Friends/FriendsSimConnector.cs
+++ b/OpenSim/Services/Connectors/Friends/FriendsSimConnector.cs
@@ -128,7 +128,7 @@ namespace OpenSim.Services.Connectors.Friends
128 return Call(region, sendData); 128 return Call(region, sendData);
129 } 129 }
130 130
131 public bool StatusNotify(GridRegion region, UUID userID, UUID friendID, bool online) 131 public bool StatusNotify(GridRegion region, UUID userID, string friendID, bool online)
132 { 132 {
133 Dictionary<string, object> sendData = new Dictionary<string, object>(); 133 Dictionary<string, object> sendData = new Dictionary<string, object>();
134 //sendData["VERSIONMIN"] = ProtocolVersions.ClientProtocolVersionMin.ToString(); 134 //sendData["VERSIONMIN"] = ProtocolVersions.ClientProtocolVersionMin.ToString();
@@ -136,7 +136,7 @@ namespace OpenSim.Services.Connectors.Friends
136 sendData["METHOD"] = "status"; 136 sendData["METHOD"] = "status";
137 137
138 sendData["FromID"] = userID.ToString(); 138 sendData["FromID"] = userID.ToString();
139 sendData["ToID"] = friendID.ToString(); 139 sendData["ToID"] = friendID;
140 sendData["Online"] = online.ToString(); 140 sendData["Online"] = online.ToString();
141 141
142 return Call(region, sendData); 142 return Call(region, sendData);
@@ -154,7 +154,7 @@ namespace OpenSim.Services.Connectors.Friends
154 if (!region.ServerURI.EndsWith("/")) 154 if (!region.ServerURI.EndsWith("/"))
155 path = "/" + path; 155 path = "/" + path;
156 string uri = region.ServerURI + path; 156 string uri = region.ServerURI + path;
157 m_log.DebugFormat("[FRIENDS SIM CONNECTOR]: calling {0}", uri); 157 // m_log.DebugFormat("[FRIENDS SIM CONNECTOR]: calling {0}", uri);
158 158
159 try 159 try
160 { 160 {
diff --git a/OpenSim/Services/Connectors/GridUser/GridUserServicesConnector.cs b/OpenSim/Services/Connectors/GridUser/GridUserServicesConnector.cs
index 20d7eaf..94bda82 100644
--- a/OpenSim/Services/Connectors/GridUser/GridUserServicesConnector.cs
+++ b/OpenSim/Services/Connectors/GridUser/GridUserServicesConnector.cs
@@ -207,7 +207,7 @@ namespace OpenSim.Services.Connectors
207 if ((replyData != null) && replyData.ContainsKey("result") && (replyData["result"] != null)) 207 if ((replyData != null) && replyData.ContainsKey("result") && (replyData["result"] != null))
208 { 208 {
209 if (replyData["result"] is Dictionary<string, object>) 209 if (replyData["result"] is Dictionary<string, object>)
210 guinfo = new GridUserInfo((Dictionary<string, object>)replyData["result"]); 210 guinfo = Create((Dictionary<string, object>)replyData["result"]);
211 } 211 }
212 212
213 return guinfo; 213 return guinfo;
@@ -273,7 +273,7 @@ namespace OpenSim.Services.Connectors
273 { 273 {
274 if (griduser is Dictionary<string, object>) 274 if (griduser is Dictionary<string, object>)
275 { 275 {
276 GridUserInfo pinfo = new GridUserInfo((Dictionary<string, object>)griduser); 276 GridUserInfo pinfo = Create((Dictionary<string, object>)griduser);
277 rinfos.Add(pinfo); 277 rinfos.Add(pinfo);
278 } 278 }
279 else 279 else
@@ -286,5 +286,10 @@ namespace OpenSim.Services.Connectors
286 286
287 return rinfos.ToArray(); 287 return rinfos.ToArray();
288 } 288 }
289
290 protected virtual GridUserInfo Create(Dictionary<string, object> griduser)
291 {
292 return new GridUserInfo(griduser);
293 }
289 } 294 }
290} 295}
diff --git a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs
index 4cd933c..d840527 100644
--- a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs
@@ -321,7 +321,7 @@ namespace OpenSim.Services.Connectors.Hypergrid
321 args["destination_uuid"] = OSD.FromString(destination.RegionID.ToString()); 321 args["destination_uuid"] = OSD.FromString(destination.RegionID.ToString());
322 args["teleport_flags"] = OSD.FromString(flags.ToString()); 322 args["teleport_flags"] = OSD.FromString(flags.ToString());
323 323
324 OSDMap result = WebUtil.PostToService(uri, args, 20000); 324 OSDMap result = WebUtil.PostToService(uri, args, 80000);
325 if (result["Success"].AsBoolean()) 325 if (result["Success"].AsBoolean())
326 { 326 {
327 OSDMap unpacked = (OSDMap)result["_Result"]; 327 OSDMap unpacked = (OSDMap)result["_Result"];
diff --git a/OpenSim/Services/Connectors/Neighbour/NeighbourServicesConnector.cs b/OpenSim/Services/Connectors/Neighbour/NeighbourServicesConnector.cs
index 7429293..7688e0f 100644
--- a/OpenSim/Services/Connectors/Neighbour/NeighbourServicesConnector.cs
+++ b/OpenSim/Services/Connectors/Neighbour/NeighbourServicesConnector.cs
@@ -153,9 +153,9 @@ namespace OpenSim.Services.Connectors
153 } 153 }
154 catch (Exception e) 154 catch (Exception e)
155 { 155 {
156 m_log.WarnFormat( 156// m_log.WarnFormat(
157 "[NEIGHBOUR SERVICE CONNCTOR]: Unable to send HelloNeighbour from {0} to {1}. Exception {2}{3}", 157// "[NEIGHBOUR SERVICE CONNCTOR]: Unable to send HelloNeighbour from {0} to {1}. Exception {2}{3}",
158 thisRegion.RegionName, region.RegionName, e.Message, e.StackTrace); 158// thisRegion.RegionName, region.RegionName, e.Message, e.StackTrace);
159 159
160 return false; 160 return false;
161 } 161 }
@@ -202,4 +202,4 @@ namespace OpenSim.Services.Connectors
202 return true; 202 return true;
203 } 203 }
204 } 204 }
205} \ No newline at end of file 205}
diff --git a/OpenSim/Services/Connectors/Properties/AssemblyInfo.cs b/OpenSim/Services/Connectors/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..bfb681b
--- /dev/null
+++ b/OpenSim/Services/Connectors/Properties/AssemblyInfo.cs
@@ -0,0 +1,33 @@
1using System.Reflection;
2using System.Runtime.CompilerServices;
3using System.Runtime.InteropServices;
4
5// General Information about an assembly is controlled through the following
6// set of attributes. Change these attribute values to modify the information
7// associated with an assembly.
8[assembly: AssemblyTitle("OpenSim.Services.Connectors")]
9[assembly: AssemblyDescription("")]
10[assembly: AssemblyConfiguration("")]
11[assembly: AssemblyCompany("http://opensimulator.org")]
12[assembly: AssemblyProduct("OpenSim")]
13[assembly: AssemblyCopyright("OpenSimulator developers")]
14[assembly: AssemblyTrademark("")]
15[assembly: AssemblyCulture("")]
16
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
19// COM, set the ComVisible attribute to true on that type.
20[assembly: ComVisible(false)]
21
22// The following GUID is for the ID of the typelib if this project is exposed to COM
23[assembly: Guid("3ab0a9a1-3f45-4c07-a892-3848df8c0173")]
24
25// Version information for an assembly consists of the following four values:
26//
27// Major Version
28// Minor Version
29// Build Number
30// Revision
31//
32[assembly: AssemblyVersion("0.7.5.*")]
33[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs
index 6bfc5cc..63a32e7 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs
@@ -45,7 +45,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
45 /// <summary> 45 /// <summary>
46 /// Connects to the SimianGrid asset service 46 /// Connects to the SimianGrid asset service
47 /// </summary> 47 /// </summary>
48 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] 48 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "SimianAssetServiceConnector")]
49 public class SimianAssetServiceConnector : IAssetService, ISharedRegionModule 49 public class SimianAssetServiceConnector : IAssetService, ISharedRegionModule
50 { 50 {
51 private static readonly ILog m_log = 51 private static readonly ILog m_log =
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs
index ffae0da..03b19ae 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs
@@ -43,7 +43,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
43 /// <summary> 43 /// <summary>
44 /// Connects authentication/authorization to the SimianGrid backend 44 /// Connects authentication/authorization to the SimianGrid backend
45 /// </summary> 45 /// </summary>
46 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] 46 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "SimianAuthenticationServiceConnector")]
47 public class SimianAuthenticationServiceConnector : IAuthenticationService, ISharedRegionModule 47 public class SimianAuthenticationServiceConnector : IAuthenticationService, ISharedRegionModule
48 { 48 {
49 private static readonly ILog m_log = 49 private static readonly ILog m_log =
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs
index 360f0dd..841bfa0 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs
@@ -47,7 +47,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
47 /// <summary> 47 /// <summary>
48 /// Connects avatar appearance data to the SimianGrid backend 48 /// Connects avatar appearance data to the SimianGrid backend
49 /// </summary> 49 /// </summary>
50 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] 50 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "SimianAvatarServiceConnector")]
51 public class SimianAvatarServiceConnector : IAvatarService, ISharedRegionModule 51 public class SimianAvatarServiceConnector : IAvatarService, ISharedRegionModule
52 { 52 {
53 private static readonly ILog m_log = 53 private static readonly ILog m_log =
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs
index 0e4d794..20eaa3a 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs
@@ -112,7 +112,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
112// m_log.Warn("Registering region " + regionInfo.RegionName + " (" + regionInfo.RegionID + ") that we are not tracking"); 112// m_log.Warn("Registering region " + regionInfo.RegionName + " (" + regionInfo.RegionID + ") that we are not tracking");
113 113
114 Vector3d minPosition = new Vector3d(regionInfo.RegionLocX, regionInfo.RegionLocY, 0.0); 114 Vector3d minPosition = new Vector3d(regionInfo.RegionLocX, regionInfo.RegionLocY, 0.0);
115 Vector3d maxPosition = minPosition + new Vector3d(Constants.RegionSize, Constants.RegionSize, 4096.0); 115 Vector3d maxPosition = minPosition + new Vector3d(Constants.RegionSize, Constants.RegionSize, Constants.RegionHeight);
116 116
117 OSDMap extraData = new OSDMap 117 OSDMap extraData = new OSDMap
118 { 118 {
@@ -297,7 +297,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
297 List<GridRegion> foundRegions = new List<GridRegion>(); 297 List<GridRegion> foundRegions = new List<GridRegion>();
298 298
299 Vector3d minPosition = new Vector3d(xmin, ymin, 0.0); 299 Vector3d minPosition = new Vector3d(xmin, ymin, 0.0);
300 Vector3d maxPosition = new Vector3d(xmax, ymax, 4096.0); 300 Vector3d maxPosition = new Vector3d(xmax, ymax, Constants.RegionHeight);
301 301
302 NameValueCollection requestArgs = new NameValueCollection 302 NameValueCollection requestArgs = new NameValueCollection
303 { 303 {
@@ -395,8 +395,8 @@ namespace OpenSim.Services.Connectors.SimianGrid
395 if (response["Success"].AsBoolean()) 395 if (response["Success"].AsBoolean())
396 { 396 {
397 OSDMap extraData = response["ExtraData"] as OSDMap; 397 OSDMap extraData = response["ExtraData"] as OSDMap;
398 int enabled = response["Enabled"].AsBoolean() ? (int) OpenSim.Data.RegionFlags.RegionOnline : 0; 398 int enabled = response["Enabled"].AsBoolean() ? (int)OpenSim.Framework.RegionFlags.RegionOnline : 0;
399 int hypergrid = extraData["HyperGrid"].AsBoolean() ? (int) OpenSim.Data.RegionFlags.Hyperlink : 0; 399 int hypergrid = extraData["HyperGrid"].AsBoolean() ? (int)OpenSim.Framework.RegionFlags.Hyperlink : 0;
400 int flags = enabled | hypergrid; 400 int flags = enabled | hypergrid;
401 m_log.DebugFormat("[SGGC] enabled - {0} hg - {1} flags - {2}", enabled, hypergrid, flags); 401 m_log.DebugFormat("[SGGC] enabled - {0} hg - {1} flags - {2}", enabled, hypergrid, flags);
402 return flags; 402 return flags;
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs
index f828abb..a391275 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs
@@ -59,7 +59,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
59 /// <summary> 59 /// <summary>
60 /// Connects avatar inventories to the SimianGrid backend 60 /// Connects avatar inventories to the SimianGrid backend
61 /// </summary> 61 /// </summary>
62 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] 62 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "SimianInventoryServiceConnector")]
63 public class SimianInventoryServiceConnector : IInventoryService, ISharedRegionModule 63 public class SimianInventoryServiceConnector : IInventoryService, ISharedRegionModule
64 { 64 {
65 private static readonly ILog m_log = 65 private static readonly ILog m_log =
@@ -781,7 +781,6 @@ namespace OpenSim.Services.Connectors.SimianGrid
781 invItem.CreationDate = item["CreationDate"].AsInteger(); 781 invItem.CreationDate = item["CreationDate"].AsInteger();
782 invItem.CreatorId = item["CreatorID"].AsString(); 782 invItem.CreatorId = item["CreatorID"].AsString();
783 invItem.CreatorData = item["CreatorData"].AsString(); 783 invItem.CreatorData = item["CreatorData"].AsString();
784 invItem.CreatorIdAsUuid = item["CreatorID"].AsUUID();
785 invItem.Description = item["Description"].AsString(); 784 invItem.Description = item["Description"].AsString();
786 invItem.Folder = item["ParentID"].AsUUID(); 785 invItem.Folder = item["ParentID"].AsUUID();
787 invItem.ID = item["ID"].AsUUID(); 786 invItem.ID = item["ID"].AsUUID();
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs
index ca1b64f..854bea4 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs
@@ -47,7 +47,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
47 /// Connects avatar presence information (for tracking current location and 47 /// Connects avatar presence information (for tracking current location and
48 /// message routing) to the SimianGrid backend 48 /// message routing) to the SimianGrid backend
49 /// </summary> 49 /// </summary>
50 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] 50 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "SimianPresenceServiceConnector")]
51 public class SimianPresenceServiceConnector : IPresenceService, IGridUserService, ISharedRegionModule 51 public class SimianPresenceServiceConnector : IPresenceService, IGridUserService, ISharedRegionModule
52 { 52 {
53 private static readonly ILog m_log = 53 private static readonly ILog m_log =
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianProfiles.cs b/OpenSim/Services/Connectors/SimianGrid/SimianProfiles.cs
index 6aefc38..bd8069f 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianProfiles.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianProfiles.cs
@@ -59,7 +59,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
59 /// Connects avatar profile and classified queries to the SimianGrid 59 /// Connects avatar profile and classified queries to the SimianGrid
60 /// backend 60 /// backend
61 /// </summary> 61 /// </summary>
62 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] 62 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "SimianProfiles")]
63 public class SimianProfiles : INonSharedRegionModule 63 public class SimianProfiles : INonSharedRegionModule
64 { 64 {
65 private static readonly ILog m_log = 65 private static readonly ILog m_log =
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs
index f38ebe8..fcb5115 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs
@@ -45,7 +45,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
45 /// Connects user account data (creating new users, looking up existing 45 /// Connects user account data (creating new users, looking up existing
46 /// users) to the SimianGrid backend 46 /// users) to the SimianGrid backend
47 /// </summary> 47 /// </summary>
48 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] 48 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "SimianUserAccountServiceConnector")]
49 public class SimianUserAccountServiceConnector : IUserAccountService, ISharedRegionModule 49 public class SimianUserAccountServiceConnector : IUserAccountService, ISharedRegionModule
50 { 50 {
51 private const double CACHE_EXPIRATION_SECONDS = 120.0; 51 private const double CACHE_EXPIRATION_SECONDS = 120.0;
diff --git a/OpenSim/Services/FreeswitchService/Properties/AssemblyInfo.cs b/OpenSim/Services/FreeswitchService/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..58c7283
--- /dev/null
+++ b/OpenSim/Services/FreeswitchService/Properties/AssemblyInfo.cs
@@ -0,0 +1,33 @@
1using System.Reflection;
2using System.Runtime.CompilerServices;
3using System.Runtime.InteropServices;
4
5// General Information about an assembly is controlled through the following
6// set of attributes. Change these attribute values to modify the information
7// associated with an assembly.
8[assembly: AssemblyTitle("OpenSim.Services.FreeswitchService")]
9[assembly: AssemblyDescription("")]
10[assembly: AssemblyConfiguration("")]
11[assembly: AssemblyCompany("http://opensimulator.org")]
12[assembly: AssemblyProduct("OpenSim")]
13[assembly: AssemblyCopyright("OpenSimulator developers")]
14[assembly: AssemblyTrademark("")]
15[assembly: AssemblyCulture("")]
16
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
19// COM, set the ComVisible attribute to true on that type.
20[assembly: ComVisible(false)]
21
22// The following GUID is for the ID of the typelib if this project is exposed to COM
23[assembly: Guid("af7d2401-cfd9-4ba5-8d6c-8af629984123")]
24
25// Version information for an assembly consists of the following four values:
26//
27// Major Version
28// Minor Version
29// Build Number
30// Revision
31//
32[assembly: AssemblyVersion("0.7.5.*")]
33[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenSim/Services/Friends/Properties/AssemblyInfo.cs b/OpenSim/Services/Friends/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..dddb091
--- /dev/null
+++ b/OpenSim/Services/Friends/Properties/AssemblyInfo.cs
@@ -0,0 +1,33 @@
1using System.Reflection;
2using System.Runtime.CompilerServices;
3using System.Runtime.InteropServices;
4
5// General Information about an assembly is controlled through the following
6// set of attributes. Change these attribute values to modify the information
7// associated with an assembly.
8[assembly: AssemblyTitle("OpenSim.Services.FriendsService")]
9[assembly: AssemblyDescription("")]
10[assembly: AssemblyConfiguration("")]
11[assembly: AssemblyCompany("http://opensimulator.org")]
12[assembly: AssemblyProduct("OpenSim")]
13[assembly: AssemblyCopyright("OpenSimulator developers")]
14[assembly: AssemblyTrademark("")]
15[assembly: AssemblyCulture("")]
16
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
19// COM, set the ComVisible attribute to true on that type.
20[assembly: ComVisible(false)]
21
22// The following GUID is for the ID of the typelib if this project is exposed to COM
23[assembly: Guid("a265d071-e152-42cc-9674-3ddd053977f5")]
24
25// Version information for an assembly consists of the following four values:
26//
27// Major Version
28// Minor Version
29// Build Number
30// Revision
31//
32[assembly: AssemblyVersion("0.7.5.*")]
33[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs
index aab403a..ee3b858 100644
--- a/OpenSim/Services/GridService/GridService.cs
+++ b/OpenSim/Services/GridService/GridService.cs
@@ -137,20 +137,25 @@ namespace OpenSim.Services.GridService
137 if (regionInfos.RegionID == UUID.Zero) 137 if (regionInfos.RegionID == UUID.Zero)
138 return "Invalid RegionID - cannot be zero UUID"; 138 return "Invalid RegionID - cannot be zero UUID";
139 139
140 // This needs better sanity testing. What if regionInfo is registering in
141 // overlapping coords?
142 RegionData region = m_Database.Get(regionInfos.RegionLocX, regionInfos.RegionLocY, scopeID); 140 RegionData region = m_Database.Get(regionInfos.RegionLocX, regionInfos.RegionLocY, scopeID);
141 if ((region != null) && (region.RegionID != regionInfos.RegionID))
142 {
143 m_log.WarnFormat("[GRID SERVICE]: Region {0} tried to register in coordinates {1}, {2} which are already in use in scope {3}.",
144 regionInfos.RegionID, regionInfos.RegionLocX, regionInfos.RegionLocY, scopeID);
145 return "Region overlaps another region";
146 }
147
143 if (region != null) 148 if (region != null)
144 { 149 {
145 // There is a preexisting record 150 // There is a preexisting record
146 // 151 //
147 // Get it's flags 152 // Get it's flags
148 // 153 //
149 OpenSim.Data.RegionFlags rflags = (OpenSim.Data.RegionFlags)Convert.ToInt32(region.Data["flags"]); 154 OpenSim.Framework.RegionFlags rflags = (OpenSim.Framework.RegionFlags)Convert.ToInt32(region.Data["flags"]);
150 155
151 // Is this a reservation? 156 // Is this a reservation?
152 // 157 //
153 if ((rflags & OpenSim.Data.RegionFlags.Reservation) != 0) 158 if ((rflags & OpenSim.Framework.RegionFlags.Reservation) != 0)
154 { 159 {
155 // Regions reserved for the null key cannot be taken. 160 // Regions reserved for the null key cannot be taken.
156 if ((string)region.Data["PrincipalID"] == UUID.Zero.ToString()) 161 if ((string)region.Data["PrincipalID"] == UUID.Zero.ToString())
@@ -161,10 +166,10 @@ namespace OpenSim.Services.GridService
161 // NOTE: Fudging the flags value here, so these flags 166 // NOTE: Fudging the flags value here, so these flags
162 // should not be used elsewhere. Don't optimize 167 // should not be used elsewhere. Don't optimize
163 // this with the later retrieval of the same flags! 168 // this with the later retrieval of the same flags!
164 rflags |= OpenSim.Data.RegionFlags.Authenticate; 169 rflags |= OpenSim.Framework.RegionFlags.Authenticate;
165 } 170 }
166 171
167 if ((rflags & OpenSim.Data.RegionFlags.Authenticate) != 0) 172 if ((rflags & OpenSim.Framework.RegionFlags.Authenticate) != 0)
168 { 173 {
169 // Can we authenticate at all? 174 // Can we authenticate at all?
170 // 175 //
@@ -176,19 +181,36 @@ namespace OpenSim.Services.GridService
176 } 181 }
177 } 182 }
178 183
179 if ((region != null) && (region.RegionID != regionInfos.RegionID)) 184 // If we get here, the destination is clear. Now for the real check.
185
186 if (!m_AllowDuplicateNames)
180 { 187 {
181 m_log.WarnFormat("[GRID SERVICE]: Region {0} tried to register in coordinates {1}, {2} which are already in use in scope {3}.", 188 List<RegionData> dupe = m_Database.Get(regionInfos.RegionName, scopeID);
182 regionInfos.RegionID, regionInfos.RegionLocX, regionInfos.RegionLocY, scopeID); 189 if (dupe != null && dupe.Count > 0)
183 return "Region overlaps another region"; 190 {
191 foreach (RegionData d in dupe)
192 {
193 if (d.RegionID != regionInfos.RegionID)
194 {
195 m_log.WarnFormat("[GRID SERVICE]: Region {0} tried to register duplicate name with ID {1}.",
196 regionInfos.RegionName, regionInfos.RegionID);
197 return "Duplicate region name";
198 }
199 }
200 }
184 } 201 }
185 202
203 // If there is an old record for us, delete it if it is elsewhere.
204 region = m_Database.Get(regionInfos.RegionID, scopeID);
186 if ((region != null) && (region.RegionID == regionInfos.RegionID) && 205 if ((region != null) && (region.RegionID == regionInfos.RegionID) &&
187 ((region.posX != regionInfos.RegionLocX) || (region.posY != regionInfos.RegionLocY))) 206 ((region.posX != regionInfos.RegionLocX) || (region.posY != regionInfos.RegionLocY)))
188 { 207 {
189 if ((Convert.ToInt32(region.Data["flags"]) & (int)OpenSim.Data.RegionFlags.NoMove) != 0) 208 if ((Convert.ToInt32(region.Data["flags"]) & (int)OpenSim.Framework.RegionFlags.NoMove) != 0)
190 return "Can't move this region"; 209 return "Can't move this region";
191 210
211 if ((Convert.ToInt32(region.Data["flags"]) & (int)OpenSim.Framework.RegionFlags.LockedOut) != 0)
212 return "Region locked out";
213
192 // Region reregistering in other coordinates. Delete the old entry 214 // Region reregistering in other coordinates. Delete the old entry
193 m_log.DebugFormat("[GRID SERVICE]: Region {0} ({1}) was previously registered at {2}-{3}. Deleting old entry.", 215 m_log.DebugFormat("[GRID SERVICE]: Region {0} ({1}) was previously registered at {2}-{3}. Deleting old entry.",
194 regionInfos.RegionName, regionInfos.RegionID, regionInfos.RegionLocX, regionInfos.RegionLocY); 216 regionInfos.RegionName, regionInfos.RegionID, regionInfos.RegionLocX, regionInfos.RegionLocY);
@@ -203,23 +225,6 @@ namespace OpenSim.Services.GridService
203 } 225 }
204 } 226 }
205 227
206 if (!m_AllowDuplicateNames)
207 {
208 List<RegionData> dupe = m_Database.Get(regionInfos.RegionName, scopeID);
209 if (dupe != null && dupe.Count > 0)
210 {
211 foreach (RegionData d in dupe)
212 {
213 if (d.RegionID != regionInfos.RegionID)
214 {
215 m_log.WarnFormat("[GRID SERVICE]: Region {0} tried to register duplicate name with ID {1}.",
216 regionInfos.RegionName, regionInfos.RegionID);
217 return "Duplicate region name";
218 }
219 }
220 }
221 }
222
223 // Everything is ok, let's register 228 // Everything is ok, let's register
224 RegionData rdata = RegionInfo2RegionData(regionInfos); 229 RegionData rdata = RegionInfo2RegionData(regionInfos);
225 rdata.ScopeID = scopeID; 230 rdata.ScopeID = scopeID;
@@ -227,10 +232,8 @@ namespace OpenSim.Services.GridService
227 if (region != null) 232 if (region != null)
228 { 233 {
229 int oldFlags = Convert.ToInt32(region.Data["flags"]); 234 int oldFlags = Convert.ToInt32(region.Data["flags"]);
230 if ((oldFlags & (int)OpenSim.Data.RegionFlags.LockedOut) != 0)
231 return "Region locked out";
232 235
233 oldFlags &= ~(int)OpenSim.Data.RegionFlags.Reservation; 236 oldFlags &= ~(int)OpenSim.Framework.RegionFlags.Reservation;
234 237
235 rdata.Data["flags"] = oldFlags.ToString(); // Preserve flags 238 rdata.Data["flags"] = oldFlags.ToString(); // Preserve flags
236 } 239 }
@@ -249,7 +252,7 @@ namespace OpenSim.Services.GridService
249 } 252 }
250 253
251 int flags = Convert.ToInt32(rdata.Data["flags"]); 254 int flags = Convert.ToInt32(rdata.Data["flags"]);
252 flags |= (int)OpenSim.Data.RegionFlags.RegionOnline; 255 flags |= (int)OpenSim.Framework.RegionFlags.RegionOnline;
253 rdata.Data["flags"] = flags.ToString(); 256 rdata.Data["flags"] = flags.ToString();
254 257
255 try 258 try
@@ -280,9 +283,9 @@ namespace OpenSim.Services.GridService
280 283
281 int flags = Convert.ToInt32(region.Data["flags"]); 284 int flags = Convert.ToInt32(region.Data["flags"]);
282 285
283 if (!m_DeleteOnUnregister || (flags & (int)OpenSim.Data.RegionFlags.Persistent) != 0) 286 if (!m_DeleteOnUnregister || (flags & (int)OpenSim.Framework.RegionFlags.Persistent) != 0)
284 { 287 {
285 flags &= ~(int)OpenSim.Data.RegionFlags.RegionOnline; 288 flags &= ~(int)OpenSim.Framework.RegionFlags.RegionOnline;
286 region.Data["flags"] = flags.ToString(); 289 region.Data["flags"] = flags.ToString();
287 region.Data["last_seen"] = Util.UnixTimeSinceEpoch(); 290 region.Data["last_seen"] = Util.UnixTimeSinceEpoch();
288 try 291 try
@@ -317,7 +320,7 @@ namespace OpenSim.Services.GridService
317 if (rdata.RegionID != regionID) 320 if (rdata.RegionID != regionID)
318 { 321 {
319 int flags = Convert.ToInt32(rdata.Data["flags"]); 322 int flags = Convert.ToInt32(rdata.Data["flags"]);
320 if ((flags & (int)Data.RegionFlags.Hyperlink) == 0) // no hyperlinks as neighbours 323 if ((flags & (int)Framework.RegionFlags.Hyperlink) == 0) // no hyperlinks as neighbours
321 rinfos.Add(RegionData2RegionInfo(rdata)); 324 rinfos.Add(RegionData2RegionInfo(rdata));
322 } 325 }
323 } 326 }
@@ -467,7 +470,7 @@ namespace OpenSim.Services.GridService
467 470
468 foreach (RegionData r in regions) 471 foreach (RegionData r in regions)
469 { 472 {
470 if ((Convert.ToInt32(r.Data["flags"]) & (int)OpenSim.Data.RegionFlags.RegionOnline) != 0) 473 if ((Convert.ToInt32(r.Data["flags"]) & (int)OpenSim.Framework.RegionFlags.RegionOnline) != 0)
471 ret.Add(RegionData2RegionInfo(r)); 474 ret.Add(RegionData2RegionInfo(r));
472 } 475 }
473 476
@@ -483,7 +486,7 @@ namespace OpenSim.Services.GridService
483 486
484 foreach (RegionData r in regions) 487 foreach (RegionData r in regions)
485 { 488 {
486 if ((Convert.ToInt32(r.Data["flags"]) & (int)OpenSim.Data.RegionFlags.RegionOnline) != 0) 489 if ((Convert.ToInt32(r.Data["flags"]) & (int)OpenSim.Framework.RegionFlags.RegionOnline) != 0)
487 ret.Add(RegionData2RegionInfo(r)); 490 ret.Add(RegionData2RegionInfo(r));
488 } 491 }
489 492
@@ -499,7 +502,7 @@ namespace OpenSim.Services.GridService
499 502
500 foreach (RegionData r in regions) 503 foreach (RegionData r in regions)
501 { 504 {
502 if ((Convert.ToInt32(r.Data["flags"]) & (int)OpenSim.Data.RegionFlags.RegionOnline) != 0) 505 if ((Convert.ToInt32(r.Data["flags"]) & (int)OpenSim.Framework.RegionFlags.RegionOnline) != 0)
503 ret.Add(RegionData2RegionInfo(r)); 506 ret.Add(RegionData2RegionInfo(r));
504 } 507 }
505 508
@@ -626,7 +629,7 @@ namespace OpenSim.Services.GridService
626 629
627 private void OutputRegionToConsole(RegionData r) 630 private void OutputRegionToConsole(RegionData r)
628 { 631 {
629 OpenSim.Data.RegionFlags flags = (OpenSim.Data.RegionFlags)Convert.ToInt32(r.Data["flags"]); 632 OpenSim.Framework.RegionFlags flags = (OpenSim.Framework.RegionFlags)Convert.ToInt32(r.Data["flags"]);
630 633
631 ConsoleDisplayList dispList = new ConsoleDisplayList(); 634 ConsoleDisplayList dispList = new ConsoleDisplayList();
632 dispList.AddRow("Region Name", r.RegionName); 635 dispList.AddRow("Region Name", r.RegionName);
@@ -656,7 +659,7 @@ namespace OpenSim.Services.GridService
656 659
657 foreach (RegionData r in regions) 660 foreach (RegionData r in regions)
658 { 661 {
659 OpenSim.Data.RegionFlags flags = (OpenSim.Data.RegionFlags)Convert.ToInt32(r.Data["flags"]); 662 OpenSim.Framework.RegionFlags flags = (OpenSim.Framework.RegionFlags)Convert.ToInt32(r.Data["flags"]);
660 dispTable.AddRow( 663 dispTable.AddRow(
661 r.RegionName, 664 r.RegionName,
662 r.RegionID.ToString(), 665 r.RegionID.ToString(),
@@ -670,7 +673,7 @@ namespace OpenSim.Services.GridService
670 673
671 private int ParseFlags(int prev, string flags) 674 private int ParseFlags(int prev, string flags)
672 { 675 {
673 OpenSim.Data.RegionFlags f = (OpenSim.Data.RegionFlags)prev; 676 OpenSim.Framework.RegionFlags f = (OpenSim.Framework.RegionFlags)prev;
674 677
675 string[] parts = flags.Split(new char[] {',', ' '}, StringSplitOptions.RemoveEmptyEntries); 678 string[] parts = flags.Split(new char[] {',', ' '}, StringSplitOptions.RemoveEmptyEntries);
676 679
@@ -682,18 +685,18 @@ namespace OpenSim.Services.GridService
682 { 685 {
683 if (p.StartsWith("+")) 686 if (p.StartsWith("+"))
684 { 687 {
685 val = (int)Enum.Parse(typeof(OpenSim.Data.RegionFlags), p.Substring(1)); 688 val = (int)Enum.Parse(typeof(OpenSim.Framework.RegionFlags), p.Substring(1));
686 f |= (OpenSim.Data.RegionFlags)val; 689 f |= (OpenSim.Framework.RegionFlags)val;
687 } 690 }
688 else if (p.StartsWith("-")) 691 else if (p.StartsWith("-"))
689 { 692 {
690 val = (int)Enum.Parse(typeof(OpenSim.Data.RegionFlags), p.Substring(1)); 693 val = (int)Enum.Parse(typeof(OpenSim.Framework.RegionFlags), p.Substring(1));
691 f &= ~(OpenSim.Data.RegionFlags)val; 694 f &= ~(OpenSim.Framework.RegionFlags)val;
692 } 695 }
693 else 696 else
694 { 697 {
695 val = (int)Enum.Parse(typeof(OpenSim.Data.RegionFlags), p); 698 val = (int)Enum.Parse(typeof(OpenSim.Framework.RegionFlags), p);
696 f |= (OpenSim.Data.RegionFlags)val; 699 f |= (OpenSim.Framework.RegionFlags)val;
697 } 700 }
698 } 701 }
699 catch (Exception) 702 catch (Exception)
@@ -725,7 +728,7 @@ namespace OpenSim.Services.GridService
725 int flags = Convert.ToInt32(r.Data["flags"]); 728 int flags = Convert.ToInt32(r.Data["flags"]);
726 flags = ParseFlags(flags, cmd[4]); 729 flags = ParseFlags(flags, cmd[4]);
727 r.Data["flags"] = flags.ToString(); 730 r.Data["flags"] = flags.ToString();
728 OpenSim.Data.RegionFlags f = (OpenSim.Data.RegionFlags)flags; 731 OpenSim.Framework.RegionFlags f = (OpenSim.Framework.RegionFlags)flags;
729 732
730 MainConsole.Instance.Output(String.Format("Set region {0} to {1}", r.RegionName, f)); 733 MainConsole.Instance.Output(String.Format("Set region {0} to {1}", r.RegionName, f));
731 m_Database.Store(r); 734 m_Database.Store(r);
diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs
index 78eab3d..743d089 100644
--- a/OpenSim/Services/GridService/HypergridLinker.cs
+++ b/OpenSim/Services/GridService/HypergridLinker.cs
@@ -390,8 +390,8 @@ namespace OpenSim.Services.GridService
390 List<RegionData> regions = m_Database.Get(mapName, m_ScopeID); 390 List<RegionData> regions = m_Database.Get(mapName, m_ScopeID);
391 if (regions != null && regions.Count > 0) 391 if (regions != null && regions.Count > 0)
392 { 392 {
393 OpenSim.Data.RegionFlags rflags = (OpenSim.Data.RegionFlags)Convert.ToInt32(regions[0].Data["flags"]); 393 OpenSim.Framework.RegionFlags rflags = (OpenSim.Framework.RegionFlags)Convert.ToInt32(regions[0].Data["flags"]);
394 if ((rflags & OpenSim.Data.RegionFlags.Hyperlink) != 0) 394 if ((rflags & OpenSim.Framework.RegionFlags.Hyperlink) != 0)
395 { 395 {
396 regInfo = new GridRegion(); 396 regInfo = new GridRegion();
397 regInfo.RegionID = regions[0].RegionID; 397 regInfo.RegionID = regions[0].RegionID;
@@ -460,7 +460,7 @@ namespace OpenSim.Services.GridService
460 private void AddHyperlinkRegion(GridRegion regionInfo, ulong regionHandle) 460 private void AddHyperlinkRegion(GridRegion regionInfo, ulong regionHandle)
461 { 461 {
462 RegionData rdata = m_GridService.RegionInfo2RegionData(regionInfo); 462 RegionData rdata = m_GridService.RegionInfo2RegionData(regionInfo);
463 int flags = (int)OpenSim.Data.RegionFlags.Hyperlink + (int)OpenSim.Data.RegionFlags.NoDirectLogin + (int)OpenSim.Data.RegionFlags.RegionOnline; 463 int flags = (int)OpenSim.Framework.RegionFlags.Hyperlink + (int)OpenSim.Framework.RegionFlags.NoDirectLogin + (int)OpenSim.Framework.RegionFlags.RegionOnline;
464 rdata.Data["flags"] = flags.ToString(); 464 rdata.Data["flags"] = flags.ToString();
465 465
466 m_Database.Store(rdata); 466 m_Database.Store(rdata);
diff --git a/OpenSim/Services/GridService/Properties/AssemblyInfo.cs b/OpenSim/Services/GridService/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..5c0c8f4
--- /dev/null
+++ b/OpenSim/Services/GridService/Properties/AssemblyInfo.cs
@@ -0,0 +1,33 @@
1using System.Reflection;
2using System.Runtime.CompilerServices;
3using System.Runtime.InteropServices;
4
5// General Information about an assembly is controlled through the following
6// set of attributes. Change these attribute values to modify the information
7// associated with an assembly.
8[assembly: AssemblyTitle("OpenSim.Services.GridService")]
9[assembly: AssemblyDescription("")]
10[assembly: AssemblyConfiguration("")]
11[assembly: AssemblyCompany("http://opensimulator.org")]
12[assembly: AssemblyProduct("OpenSim")]
13[assembly: AssemblyCopyright("OpenSimulator developers")]
14[assembly: AssemblyTrademark("")]
15[assembly: AssemblyCulture("")]
16
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
19// COM, set the ComVisible attribute to true on that type.
20[assembly: ComVisible(false)]
21
22// The following GUID is for the ID of the typelib if this project is exposed to COM
23[assembly: Guid("96526d7b-4943-4b8e-9f0f-5908af621090")]
24
25// Version information for an assembly consists of the following four values:
26//
27// Major Version
28// Minor Version
29// Build Number
30// Revision
31//
32[assembly: AssemblyVersion("0.7.5.*")]
33[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenSim/Services/HypergridService/GatekeeperService.cs b/OpenSim/Services/HypergridService/GatekeeperService.cs
index 47d22b9..7b84d55 100644
--- a/OpenSim/Services/HypergridService/GatekeeperService.cs
+++ b/OpenSim/Services/HypergridService/GatekeeperService.cs
@@ -57,14 +57,18 @@ namespace OpenSim.Services.HypergridService
57 private static IUserAccountService m_UserAccountService; 57 private static IUserAccountService m_UserAccountService;
58 private static IUserAgentService m_UserAgentService; 58 private static IUserAgentService m_UserAgentService;
59 private static ISimulationService m_SimulationService; 59 private static ISimulationService m_SimulationService;
60 private static IGridUserService m_GridUserService;
60 61
61 protected string m_AllowedClients = string.Empty; 62 private static string m_AllowedClients = string.Empty;
62 protected string m_DeniedClients = string.Empty; 63 private static string m_DeniedClients = string.Empty;
63 private static bool m_ForeignAgentsAllowed = true; 64 private static bool m_ForeignAgentsAllowed = true;
65 private static List<string> m_ForeignsAllowedExceptions = new List<string>();
66 private static List<string> m_ForeignsDisallowedExceptions = new List<string>();
64 67
65 private static UUID m_ScopeID; 68 private static UUID m_ScopeID;
66 private static bool m_AllowTeleportsToAnyRegion; 69 private static bool m_AllowTeleportsToAnyRegion;
67 private static string m_ExternalName; 70 private static string m_ExternalName;
71 private static Uri m_Uri;
68 private static GridRegion m_DefaultGatewayRegion; 72 private static GridRegion m_DefaultGatewayRegion;
69 73
70 public GatekeeperService(IConfigSource config, ISimulationService simService) 74 public GatekeeperService(IConfigSource config, ISimulationService simService)
@@ -82,8 +86,9 @@ namespace OpenSim.Services.HypergridService
82 string gridService = serverConfig.GetString("GridService", String.Empty); 86 string gridService = serverConfig.GetString("GridService", String.Empty);
83 string presenceService = serverConfig.GetString("PresenceService", String.Empty); 87 string presenceService = serverConfig.GetString("PresenceService", String.Empty);
84 string simulationService = serverConfig.GetString("SimulationService", String.Empty); 88 string simulationService = serverConfig.GetString("SimulationService", String.Empty);
89 string gridUserService = serverConfig.GetString("GridUserService", String.Empty);
85 90
86 // These 3 are mandatory, the others aren't 91 // These are mandatory, the others aren't
87 if (gridService == string.Empty || presenceService == string.Empty) 92 if (gridService == string.Empty || presenceService == string.Empty)
88 throw new Exception("Incomplete specifications, Gatekeeper Service cannot function."); 93 throw new Exception("Incomplete specifications, Gatekeeper Service cannot function.");
89 94
@@ -95,6 +100,15 @@ namespace OpenSim.Services.HypergridService
95 if (m_ExternalName != string.Empty && !m_ExternalName.EndsWith("/")) 100 if (m_ExternalName != string.Empty && !m_ExternalName.EndsWith("/"))
96 m_ExternalName = m_ExternalName + "/"; 101 m_ExternalName = m_ExternalName + "/";
97 102
103 try
104 {
105 m_Uri = new Uri(m_ExternalName);
106 }
107 catch
108 {
109 m_log.WarnFormat("[GATEKEEPER SERVICE]: Malformed gatekeeper address {0}", m_ExternalName);
110 }
111
98 Object[] args = new Object[] { config }; 112 Object[] args = new Object[] { config };
99 m_GridService = ServerUtils.LoadPlugin<IGridService>(gridService, args); 113 m_GridService = ServerUtils.LoadPlugin<IGridService>(gridService, args);
100 m_PresenceService = ServerUtils.LoadPlugin<IPresenceService>(presenceService, args); 114 m_PresenceService = ServerUtils.LoadPlugin<IPresenceService>(presenceService, args);
@@ -103,6 +117,8 @@ namespace OpenSim.Services.HypergridService
103 m_UserAccountService = ServerUtils.LoadPlugin<IUserAccountService>(accountService, args); 117 m_UserAccountService = ServerUtils.LoadPlugin<IUserAccountService>(accountService, args);
104 if (homeUsersService != string.Empty) 118 if (homeUsersService != string.Empty)
105 m_UserAgentService = ServerUtils.LoadPlugin<IUserAgentService>(homeUsersService, args); 119 m_UserAgentService = ServerUtils.LoadPlugin<IUserAgentService>(homeUsersService, args);
120 if (gridUserService != string.Empty)
121 m_GridUserService = ServerUtils.LoadPlugin<IGridUserService>(gridUserService, args);
106 122
107 if (simService != null) 123 if (simService != null)
108 m_SimulationService = simService; 124 m_SimulationService = simService;
@@ -113,6 +129,9 @@ namespace OpenSim.Services.HypergridService
113 m_DeniedClients = serverConfig.GetString("DeniedClients", string.Empty); 129 m_DeniedClients = serverConfig.GetString("DeniedClients", string.Empty);
114 m_ForeignAgentsAllowed = serverConfig.GetBoolean("ForeignAgentsAllowed", true); 130 m_ForeignAgentsAllowed = serverConfig.GetBoolean("ForeignAgentsAllowed", true);
115 131
132 LoadDomainExceptionsFromConfig(serverConfig, "AllowExcept", m_ForeignsAllowedExceptions);
133 LoadDomainExceptionsFromConfig(serverConfig, "DisallowExcept", m_ForeignsDisallowedExceptions);
134
116 if (m_GridService == null || m_PresenceService == null || m_SimulationService == null) 135 if (m_GridService == null || m_PresenceService == null || m_SimulationService == null)
117 throw new Exception("Unable to load a required plugin, Gatekeeper Service cannot function."); 136 throw new Exception("Unable to load a required plugin, Gatekeeper Service cannot function.");
118 137
@@ -125,6 +144,15 @@ namespace OpenSim.Services.HypergridService
125 { 144 {
126 } 145 }
127 146
147 protected void LoadDomainExceptionsFromConfig(IConfig config, string variable, List<string> exceptions)
148 {
149 string value = config.GetString(variable, string.Empty);
150 string[] parts = value.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
151
152 foreach (string s in parts)
153 exceptions.Add(s.Trim());
154 }
155
128 public bool LinkRegion(string regionName, out UUID regionID, out ulong regionHandle, out string externalName, out string imageURL, out string reason) 156 public bool LinkRegion(string regionName, out UUID regionID, out ulong regionHandle, out string externalName, out string imageURL, out string reason)
129 { 157 {
130 regionID = UUID.Zero; 158 regionID = UUID.Zero;
@@ -260,17 +288,26 @@ namespace OpenSim.Services.HypergridService
260 m_log.DebugFormat("[GATEKEEPER SERVICE]: User is ok"); 288 m_log.DebugFormat("[GATEKEEPER SERVICE]: User is ok");
261 289
262 // 290 //
263 // Foreign agents allowed 291 // Foreign agents allowed? Exceptions?
264 // 292 //
265 if (account == null && !m_ForeignAgentsAllowed) 293 if (account == null)
266 { 294 {
267 reason = "Unauthorized"; 295 bool allowed = m_ForeignAgentsAllowed;
268 m_log.InfoFormat("[GATEKEEPER SERVICE]: Foreign agents are not permitted {0} {1}. Refusing service.",
269 aCircuit.firstname, aCircuit.lastname);
270 return false;
271 }
272 296
273 // May want to authorize 297 if (m_ForeignAgentsAllowed && IsException(aCircuit, m_ForeignsAllowedExceptions))
298 allowed = false;
299
300 if (!m_ForeignAgentsAllowed && IsException(aCircuit, m_ForeignsDisallowedExceptions))
301 allowed = true;
302
303 if (!allowed)
304 {
305 reason = "Destination does not allow visitors from your world";
306 m_log.InfoFormat("[GATEKEEPER SERVICE]: Foreign agents are not permitted {0} {1} @ {2}. Refusing service.",
307 aCircuit.firstname, aCircuit.lastname, aCircuit.ServiceURLs["HomeURI"]);
308 return false;
309 }
310 }
274 311
275 bool isFirstLogin = false; 312 bool isFirstLogin = false;
276 // 313 //
@@ -280,7 +317,8 @@ namespace OpenSim.Services.HypergridService
280 if (presence != null) // it has been placed there by the login service 317 if (presence != null) // it has been placed there by the login service
281 isFirstLogin = true; 318 isFirstLogin = true;
282 319
283 else 320 else
321 {
284 if (!m_PresenceService.LoginAgent(aCircuit.AgentID.ToString(), aCircuit.SessionID, aCircuit.SecureSessionID)) 322 if (!m_PresenceService.LoginAgent(aCircuit.AgentID.ToString(), aCircuit.SessionID, aCircuit.SecureSessionID))
285 { 323 {
286 reason = "Unable to login presence"; 324 reason = "Unable to login presence";
@@ -290,6 +328,26 @@ namespace OpenSim.Services.HypergridService
290 } 328 }
291 m_log.DebugFormat("[GATEKEEPER SERVICE]: Login presence ok"); 329 m_log.DebugFormat("[GATEKEEPER SERVICE]: Login presence ok");
292 330
331 // Also login foreigners with GridUser service
332 if (m_GridUserService != null && account == null)
333 {
334 string userId = aCircuit.AgentID.ToString();
335 string first = aCircuit.firstname, last = aCircuit.lastname;
336 if (last.StartsWith("@"))
337 {
338 string[] parts = aCircuit.firstname.Split('.');
339 if (parts.Length >= 2)
340 {
341 first = parts[0];
342 last = parts[1];
343 }
344 }
345
346 userId += ";" + aCircuit.ServiceURLs["HomeURI"] + ";" + first + " " + last;
347 m_GridUserService.LoggedIn(userId);
348 }
349 }
350
293 // 351 //
294 // Get the region 352 // Get the region
295 // 353 //
@@ -385,7 +443,18 @@ namespace OpenSim.Services.HypergridService
385 string externalname = m_ExternalName.TrimEnd(trailing_slash); 443 string externalname = m_ExternalName.TrimEnd(trailing_slash);
386 m_log.DebugFormat("[GATEKEEPER SERVICE]: Verifying {0} against {1}", addressee, externalname); 444 m_log.DebugFormat("[GATEKEEPER SERVICE]: Verifying {0} against {1}", addressee, externalname);
387 445
388 return string.Equals(addressee, externalname, StringComparison.OrdinalIgnoreCase); 446 Uri uri;
447 try
448 {
449 uri = new Uri(addressee);
450 }
451 catch
452 {
453 m_log.DebugFormat("[GATEKEEPER SERVICE]: Visitor provided malformed service address {0}", addressee);
454 return false;
455 }
456
457 return string.Equals(uri.GetLeftPart(UriPartial.Authority), m_Uri.GetLeftPart(UriPartial.Authority), StringComparison.OrdinalIgnoreCase) ;
389 } 458 }
390 459
391 #endregion 460 #endregion
@@ -393,6 +462,27 @@ namespace OpenSim.Services.HypergridService
393 462
394 #region Misc 463 #region Misc
395 464
465 private bool IsException(AgentCircuitData aCircuit, List<string> exceptions)
466 {
467 bool exception = false;
468 if (exceptions.Count > 0) // we have exceptions
469 {
470 // Retrieve the visitor's origin
471 string userURL = aCircuit.ServiceURLs["HomeURI"].ToString();
472 if (!userURL.EndsWith("/"))
473 userURL += "/";
474
475 if (exceptions.Find(delegate(string s)
476 {
477 if (!s.EndsWith("/"))
478 s += "/";
479 return s == userURL;
480 }) != null)
481 exception = true;
482 }
483
484 return exception;
485 }
396 486
397 #endregion 487 #endregion
398 } 488 }
diff --git a/OpenSim/Services/HypergridService/HGAssetService.cs b/OpenSim/Services/HypergridService/HGAssetService.cs
index db98166..84dec8d 100644
--- a/OpenSim/Services/HypergridService/HGAssetService.cs
+++ b/OpenSim/Services/HypergridService/HGAssetService.cs
@@ -58,6 +58,8 @@ namespace OpenSim.Services.HypergridService
58 58
59 private UserAccountCache m_Cache; 59 private UserAccountCache m_Cache;
60 60
61 private AssetPermissions m_AssetPerms;
62
61 public HGAssetService(IConfigSource config, string configName) : base(config, configName) 63 public HGAssetService(IConfigSource config, string configName) : base(config, configName)
62 { 64 {
63 m_log.Debug("[HGAsset Service]: Starting"); 65 m_log.Debug("[HGAsset Service]: Starting");
@@ -80,6 +82,10 @@ namespace OpenSim.Services.HypergridService
80 m_HomeURL = assetConfig.GetString("HomeURI", m_HomeURL); 82 m_HomeURL = assetConfig.GetString("HomeURI", m_HomeURL);
81 83
82 m_Cache = UserAccountCache.CreateUserAccountCache(m_UserAccountService); 84 m_Cache = UserAccountCache.CreateUserAccountCache(m_UserAccountService);
85
86 // Permissions
87 m_AssetPerms = new AssetPermissions(assetConfig);
88
83 } 89 }
84 90
85 #region IAssetService overrides 91 #region IAssetService overrides
@@ -90,6 +96,9 @@ namespace OpenSim.Services.HypergridService
90 if (asset == null) 96 if (asset == null)
91 return null; 97 return null;
92 98
99 if (!m_AssetPerms.AllowedExport(asset.Type))
100 return null;
101
93 if (asset.Metadata.Type == (sbyte)AssetType.Object) 102 if (asset.Metadata.Type == (sbyte)AssetType.Object)
94 asset.Data = AdjustIdentifiers(asset.Data); ; 103 asset.Data = AdjustIdentifiers(asset.Data); ;
95 104
@@ -112,16 +121,27 @@ namespace OpenSim.Services.HypergridService
112 121
113 public override byte[] GetData(string id) 122 public override byte[] GetData(string id)
114 { 123 {
115 byte[] data = base.GetData(id); 124 AssetBase asset = Get(id);
125
126 if (asset == null)
127 return null;
116 128
117 if (data == null) 129 if (!m_AssetPerms.AllowedExport(asset.Type))
118 return null; 130 return null;
119 131
120 return AdjustIdentifiers(data); 132 return asset.Data;
121 } 133 }
122 134
123 //public virtual bool Get(string id, Object sender, AssetRetrieved handler) 135 //public virtual bool Get(string id, Object sender, AssetRetrieved handler)
124 136
137 public override string Store(AssetBase asset)
138 {
139 if (!m_AssetPerms.AllowedImport(asset.Type))
140 return string.Empty;
141
142 return base.Store(asset);
143 }
144
125 public override bool Delete(string id) 145 public override bool Delete(string id)
126 { 146 {
127 // NOGO 147 // NOGO
diff --git a/OpenSim/Services/HypergridService/HGFriendsService.cs b/OpenSim/Services/HypergridService/HGFriendsService.cs
index 98423d7..a8bcfb2 100644
--- a/OpenSim/Services/HypergridService/HGFriendsService.cs
+++ b/OpenSim/Services/HypergridService/HGFriendsService.cs
@@ -397,7 +397,7 @@ namespace OpenSim.Services.HypergridService
397 if (region != null) 397 if (region != null)
398 { 398 {
399 m_log.DebugFormat("[HGFRIENDS SERVICE]: Remote Notify to region {0}, user {1} is {2}", region.RegionName, foreignUserID, (online ? "online" : "offline")); 399 m_log.DebugFormat("[HGFRIENDS SERVICE]: Remote Notify to region {0}, user {1} is {2}", region.RegionName, foreignUserID, (online ? "online" : "offline"));
400 m_FriendsSimConnector.StatusNotify(region, foreignUserID, userID, online); 400 m_FriendsSimConnector.StatusNotify(region, foreignUserID, userID.ToString(), online);
401 } 401 }
402 } 402 }
403 } 403 }
diff --git a/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs b/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs
index 6e4b68c..784f136 100644
--- a/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs
+++ b/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs
@@ -56,10 +56,12 @@ namespace OpenSim.Services.HypergridService
56 56
57 private string m_HomeURL; 57 private string m_HomeURL;
58 private IUserAccountService m_UserAccountService; 58 private IUserAccountService m_UserAccountService;
59 private IAvatarService m_AvatarService;
59 60
60// private UserAccountCache m_Cache; 61// private UserAccountCache m_Cache;
61 62
62 private ExpiringCache<UUID, List<XInventoryFolder>> m_SuitcaseTrees = new ExpiringCache<UUID, List<XInventoryFolder>>(); 63 private ExpiringCache<UUID, List<XInventoryFolder>> m_SuitcaseTrees = new ExpiringCache<UUID, List<XInventoryFolder>>();
64 private ExpiringCache<UUID, AvatarAppearance> m_Appearances = new ExpiringCache<UUID, AvatarAppearance>();
63 65
64 public HGSuitcaseInventoryService(IConfigSource config, string configName) 66 public HGSuitcaseInventoryService(IConfigSource config, string configName)
65 : base(config, configName) 67 : base(config, configName)
@@ -69,7 +71,7 @@ namespace OpenSim.Services.HypergridService
69 m_ConfigName = configName; 71 m_ConfigName = configName;
70 72
71 if (m_Database == null) 73 if (m_Database == null)
72 m_log.WarnFormat("[XXX]: m_Database is null!"); 74 m_log.ErrorFormat("[HG SUITCASE INVENTORY SERVICE]: m_Database is null!");
73 75
74 // 76 //
75 // Try reading the [InventoryService] section, if it exists 77 // Try reading the [InventoryService] section, if it exists
@@ -77,7 +79,6 @@ namespace OpenSim.Services.HypergridService
77 IConfig invConfig = config.Configs[m_ConfigName]; 79 IConfig invConfig = config.Configs[m_ConfigName];
78 if (invConfig != null) 80 if (invConfig != null)
79 { 81 {
80 // realm = authConfig.GetString("Realm", realm);
81 string userAccountsDll = invConfig.GetString("UserAccountsService", string.Empty); 82 string userAccountsDll = invConfig.GetString("UserAccountsService", string.Empty);
82 if (userAccountsDll == string.Empty) 83 if (userAccountsDll == string.Empty)
83 throw new Exception("Please specify UserAccountsService in HGInventoryService configuration"); 84 throw new Exception("Please specify UserAccountsService in HGInventoryService configuration");
@@ -87,8 +88,14 @@ namespace OpenSim.Services.HypergridService
87 if (m_UserAccountService == null) 88 if (m_UserAccountService == null)
88 throw new Exception(String.Format("Unable to create UserAccountService from {0}", userAccountsDll)); 89 throw new Exception(String.Format("Unable to create UserAccountService from {0}", userAccountsDll));
89 90
90 // legacy configuration [obsolete] 91 string avatarDll = invConfig.GetString("AvatarService", string.Empty);
91 m_HomeURL = invConfig.GetString("ProfileServerURI", string.Empty); 92 if (avatarDll == string.Empty)
93 throw new Exception("Please specify AvatarService in HGInventoryService configuration");
94
95 m_AvatarService = ServerUtils.LoadPlugin<IAvatarService>(avatarDll, args);
96 if (m_AvatarService == null)
97 throw new Exception(String.Format("Unable to create m_AvatarService from {0}", avatarDll));
98
92 // Preferred 99 // Preferred
93 m_HomeURL = invConfig.GetString("HomeURI", m_HomeURL); 100 m_HomeURL = invConfig.GetString("HomeURI", m_HomeURL);
94 101
@@ -294,7 +301,7 @@ namespace OpenSim.Services.HypergridService
294 301
295 public override bool AddFolder(InventoryFolderBase folder) 302 public override bool AddFolder(InventoryFolderBase folder)
296 { 303 {
297 m_log.WarnFormat("[HG SUITCASE INVENTORY SERVICE]: AddFolder {0} {1}", folder.Name, folder.ParentID); 304 //m_log.WarnFormat("[HG SUITCASE INVENTORY SERVICE]: AddFolder {0} {1}", folder.Name, folder.ParentID);
298 // Let's do a bit of sanity checking, more than the base service does 305 // Let's do a bit of sanity checking, more than the base service does
299 // make sure the given folder's parent folder exists under the suitcase tree of this user 306 // make sure the given folder's parent folder exists under the suitcase tree of this user
300 307
@@ -316,7 +323,7 @@ namespace OpenSim.Services.HypergridService
316 323
317 public override bool UpdateFolder(InventoryFolderBase folder) 324 public override bool UpdateFolder(InventoryFolderBase folder)
318 { 325 {
319 m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: Update folder {0}, version {1}", folder.ID, folder.Version); 326 //m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: Update folder {0}, version {1}", folder.ID, folder.Version);
320 if (!IsWithinSuitcaseTree(folder.Owner, folder.ID)) 327 if (!IsWithinSuitcaseTree(folder.Owner, folder.ID))
321 { 328 {
322 m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: folder {0} not within Suitcase tree", folder.Name); 329 m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: folder {0} not within Suitcase tree", folder.Name);
@@ -394,7 +401,7 @@ namespace OpenSim.Services.HypergridService
394 return null; 401 return null;
395 } 402 }
396 403
397 if (!IsWithinSuitcaseTree(it.Owner, it.Folder)) 404 if (!IsWithinSuitcaseTree(it.Owner, it.Folder) && !IsPartOfAppearance(it.Owner, it.ID))
398 { 405 {
399 m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: Item {0} (folder {1}) is not within Suitcase", 406 m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: Item {0} (folder {1}) is not within Suitcase",
400 it.Name, it.Folder); 407 it.Name, it.Folder);
@@ -453,6 +460,15 @@ namespace OpenSim.Services.HypergridService
453 460
454 if (folders != null && folders.Length > 0) 461 if (folders != null && folders.Length > 0)
455 return folders[0]; 462 return folders[0];
463
464 // OK, so the RootFolder type didn't work. Let's look for any type with parent UUID.Zero.
465 folders = m_Database.GetFolders(
466 new string[] { "agentID", "folderName", "parentFolderID" },
467 new string[] { principalID.ToString(), "My Inventory", UUID.Zero.ToString() });
468
469 if (folders != null && folders.Length > 0)
470 return folders[0];
471
456 return null; 472 return null;
457 } 473 }
458 474
@@ -549,6 +565,52 @@ namespace OpenSim.Services.HypergridService
549 else return true; 565 else return true;
550 } 566 }
551 #endregion 567 #endregion
568
569 #region Avatar Appearance
570
571 private AvatarAppearance GetAppearance(UUID principalID)
572 {
573 AvatarAppearance a = null;
574 if (m_Appearances.TryGetValue(principalID, out a))
575 return a;
576
577 a = m_AvatarService.GetAppearance(principalID);
578 m_Appearances.AddOrUpdate(principalID, a, 5 * 60); // 5minutes
579 return a;
580 }
581
582 private bool IsPartOfAppearance(UUID principalID, UUID itemID)
583 {
584 AvatarAppearance a = GetAppearance(principalID);
585
586 if (a == null)
587 return false;
588
589 // Check wearables (body parts and clothes)
590 for (int i = 0; i < a.Wearables.Length; i++)
591 {
592 for (int j = 0; j < a.Wearables[i].Count; j++)
593 {
594 if (a.Wearables[i][j].ItemID == itemID)
595 {
596 //m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: item {0} is a wearable", itemID);
597 return true;
598 }
599 }
600 }
601
602 // Check attachments
603 if (a.GetAttachmentForItem(itemID) != null)
604 {
605 //m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: item {0} is an attachment", itemID);
606 return true;
607 }
608
609 return false;
610 }
611
612 #endregion
613
552 } 614 }
553 615
554} 616}
diff --git a/OpenSim/Services/HypergridService/Properties/AssemblyInfo.cs b/OpenSim/Services/HypergridService/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..49f2176
--- /dev/null
+++ b/OpenSim/Services/HypergridService/Properties/AssemblyInfo.cs
@@ -0,0 +1,33 @@
1using System.Reflection;
2using System.Runtime.CompilerServices;
3using System.Runtime.InteropServices;
4
5// General Information about an assembly is controlled through the following
6// set of attributes. Change these attribute values to modify the information
7// associated with an assembly.
8[assembly: AssemblyTitle("OpenSim.Services.HypergridService")]
9[assembly: AssemblyDescription("")]
10[assembly: AssemblyConfiguration("")]
11[assembly: AssemblyCompany("http://opensimulator.org")]
12[assembly: AssemblyProduct("OpenSim")]
13[assembly: AssemblyCopyright("OpenSimulator developers")]
14[assembly: AssemblyTrademark("")]
15[assembly: AssemblyCulture("")]
16
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
19// COM, set the ComVisible attribute to true on that type.
20[assembly: ComVisible(false)]
21
22// The following GUID is for the ID of the typelib if this project is exposed to COM
23[assembly: Guid("8584f3c1-26dd-4d95-86f4-cd8f0110a18f")]
24
25// Version information for an assembly consists of the following four values:
26//
27// Major Version
28// Minor Version
29// Build Number
30// Revision
31//
32[assembly: AssemblyVersion("0.7.5.*")]
33[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenSim/Services/HypergridService/UserAgentService.cs b/OpenSim/Services/HypergridService/UserAgentService.cs
index a49993c..416ad16 100644
--- a/OpenSim/Services/HypergridService/UserAgentService.cs
+++ b/OpenSim/Services/HypergridService/UserAgentService.cs
@@ -77,6 +77,10 @@ namespace OpenSim.Services.HypergridService
77 77
78 protected static bool m_BypassClientVerification; 78 protected static bool m_BypassClientVerification;
79 79
80 private static Dictionary<int, bool> m_ForeignTripsAllowed = new Dictionary<int, bool>();
81 private static Dictionary<int, List<string>> m_TripsAllowedExceptions = new Dictionary<int, List<string>>();
82 private static Dictionary<int, List<string>> m_TripsDisallowedExceptions = new Dictionary<int, List<string>>();
83
80 public UserAgentService(IConfigSource config) : this(config, null) 84 public UserAgentService(IConfigSource config) : this(config, null)
81 { 85 {
82 } 86 }
@@ -121,6 +125,12 @@ namespace OpenSim.Services.HypergridService
121 m_PresenceService = ServerUtils.LoadPlugin<IPresenceService>(presenceService, args); 125 m_PresenceService = ServerUtils.LoadPlugin<IPresenceService>(presenceService, args);
122 m_UserAccountService = ServerUtils.LoadPlugin<IUserAccountService>(userAccountService, args); 126 m_UserAccountService = ServerUtils.LoadPlugin<IUserAccountService>(userAccountService, args);
123 127
128 m_LevelOutsideContacts = serverConfig.GetInt("LevelOutsideContacts", 0);
129
130 LoadTripPermissionsFromConfig(serverConfig, "ForeignTripsAllowed");
131 LoadDomainExceptionsFromConfig(serverConfig, "AllowExcept", m_TripsAllowedExceptions);
132 LoadDomainExceptionsFromConfig(serverConfig, "DisallowExcept", m_TripsDisallowedExceptions);
133
124 m_GridName = serverConfig.GetString("ExternalName", string.Empty); 134 m_GridName = serverConfig.GetString("ExternalName", string.Empty);
125 if (m_GridName == string.Empty) 135 if (m_GridName == string.Empty)
126 { 136 {
@@ -130,10 +140,43 @@ namespace OpenSim.Services.HypergridService
130 if (!m_GridName.EndsWith("/")) 140 if (!m_GridName.EndsWith("/"))
131 m_GridName = m_GridName + "/"; 141 m_GridName = m_GridName + "/";
132 142
133 m_LevelOutsideContacts = serverConfig.GetInt("LevelOutsideContacts", 0);
134 } 143 }
135 } 144 }
136 145
146 protected void LoadTripPermissionsFromConfig(IConfig config, string variable)
147 {
148 foreach (string keyName in config.GetKeys())
149 {
150 if (keyName.StartsWith(variable + "_Level_"))
151 {
152 int level = 0;
153 if (Int32.TryParse(keyName.Replace(variable + "_Level_", ""), out level))
154 m_ForeignTripsAllowed.Add(level, config.GetBoolean(keyName, true));
155 }
156 }
157 }
158
159 protected void LoadDomainExceptionsFromConfig(IConfig config, string variable, Dictionary<int, List<string>> exceptions)
160 {
161 foreach (string keyName in config.GetKeys())
162 {
163 if (keyName.StartsWith(variable + "_Level_"))
164 {
165 int level = 0;
166 if (Int32.TryParse(keyName.Replace(variable + "_Level_", ""), out level) && !exceptions.ContainsKey(level))
167 {
168 exceptions.Add(level, new List<string>());
169 string value = config.GetString(keyName, string.Empty);
170 string[] parts = value.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
171
172 foreach (string s in parts)
173 exceptions[level].Add(s.Trim());
174 }
175 }
176 }
177 }
178
179
137 public GridRegion GetHomeRegion(UUID userID, out Vector3 position, out Vector3 lookAt) 180 public GridRegion GetHomeRegion(UUID userID, out Vector3 position, out Vector3 lookAt)
138 { 181 {
139 position = new Vector3(128, 128, 0); lookAt = Vector3.UnitY; 182 position = new Vector3(128, 128, 0); lookAt = Vector3.UnitY;
@@ -166,13 +209,39 @@ namespace OpenSim.Services.HypergridService
166 m_log.DebugFormat("[USER AGENT SERVICE]: Request to login user {0} {1} (@{2}) to grid {3}", 209 m_log.DebugFormat("[USER AGENT SERVICE]: Request to login user {0} {1} (@{2}) to grid {3}",
167 agentCircuit.firstname, agentCircuit.lastname, ((clientIP == null) ? "stored IP" : clientIP.Address.ToString()), gatekeeper.ServerURI); 210 agentCircuit.firstname, agentCircuit.lastname, ((clientIP == null) ? "stored IP" : clientIP.Address.ToString()), gatekeeper.ServerURI);
168 211
169 if (m_UserAccountService.GetUserAccount(UUID.Zero, agentCircuit.AgentID) == null) 212 string gridName = gatekeeper.ServerURI;
213
214 UserAccount account = m_UserAccountService.GetUserAccount(UUID.Zero, agentCircuit.AgentID);
215 if (account == null)
170 { 216 {
171 m_log.WarnFormat("[USER AGENT SERVICE]: Someone attempted to lauch a foreign user from here {0} {1}", agentCircuit.firstname, agentCircuit.lastname); 217 m_log.WarnFormat("[USER AGENT SERVICE]: Someone attempted to lauch a foreign user from here {0} {1}", agentCircuit.firstname, agentCircuit.lastname);
172 reason = "Forbidden to launch your agents from here"; 218 reason = "Forbidden to launch your agents from here";
173 return false; 219 return false;
174 } 220 }
175 221
222 // Is this user allowed to go there?
223 if (m_GridName != gridName)
224 {
225 if (m_ForeignTripsAllowed.ContainsKey(account.UserLevel))
226 {
227 bool allowed = m_ForeignTripsAllowed[account.UserLevel];
228
229 if (m_ForeignTripsAllowed[account.UserLevel] && IsException(gridName, account.UserLevel, m_TripsAllowedExceptions))
230 allowed = false;
231
232 if (!m_ForeignTripsAllowed[account.UserLevel] && IsException(gridName, account.UserLevel, m_TripsDisallowedExceptions))
233 allowed = true;
234
235 if (!allowed)
236 {
237 reason = "Your world does not allow you to visit the destination";
238 m_log.InfoFormat("[USER AGENT SERVICE]: Agents not permitted to visit {0}. Refusing service.", gridName);
239 return false;
240 }
241 }
242 }
243
244
176 // Take the IP address + port of the gatekeeper (reg) plus the info of finalDestination 245 // Take the IP address + port of the gatekeeper (reg) plus the info of finalDestination
177 GridRegion region = new GridRegion(gatekeeper); 246 GridRegion region = new GridRegion(gatekeeper);
178 region.ServerURI = gatekeeper.ServerURI; 247 region.ServerURI = gatekeeper.ServerURI;
@@ -189,7 +258,6 @@ namespace OpenSim.Services.HypergridService
189 258
190 bool success = false; 259 bool success = false;
191 string myExternalIP = string.Empty; 260 string myExternalIP = string.Empty;
192 string gridName = gatekeeper.ServerURI;
193 261
194 m_log.DebugFormat("[USER AGENT SERVICE]: this grid: {0}, desired grid: {1}", m_GridName, gridName); 262 m_log.DebugFormat("[USER AGENT SERVICE]: this grid: {0}, desired grid: {1}", m_GridName, gridName);
195 263
@@ -434,7 +502,7 @@ namespace OpenSim.Services.HypergridService
434 if (region != null) 502 if (region != null)
435 { 503 {
436 m_log.DebugFormat("[USER AGENT SERVICE]: Remote Notify to region {0}, user {1} is {2}", region.RegionName, foreignUserID, (online ? "online" : "offline")); 504 m_log.DebugFormat("[USER AGENT SERVICE]: Remote Notify to region {0}, user {1} is {2}", region.RegionName, foreignUserID, (online ? "online" : "offline"));
437 m_FriendsSimConnector.StatusNotify(region, foreignUserID, userID, online); 505 m_FriendsSimConnector.StatusNotify(region, foreignUserID, userID.ToString(), online);
438 } 506 }
439 } 507 }
440 } 508 }
@@ -586,6 +654,35 @@ namespace OpenSim.Services.HypergridService
586 else 654 else
587 return UUID.Zero; 655 return UUID.Zero;
588 } 656 }
657
658 #region Misc
659
660 private bool IsException(string dest, int level, Dictionary<int, List<string>> exceptions)
661 {
662 if (!exceptions.ContainsKey(level))
663 return false;
664
665 bool exception = false;
666 if (exceptions[level].Count > 0) // we have exceptions
667 {
668 string destination = dest;
669 if (!destination.EndsWith("/"))
670 destination += "/";
671
672 if (exceptions[level].Find(delegate(string s)
673 {
674 if (!s.EndsWith("/"))
675 s += "/";
676 return s == destination;
677 }) != null)
678 exception = true;
679 }
680
681 return exception;
682 }
683
684 #endregion
685
589 } 686 }
590 687
591 class TravelingAgentInfo 688 class TravelingAgentInfo
diff --git a/OpenSim/Services/Interfaces/IAssetService.cs b/OpenSim/Services/Interfaces/IAssetService.cs
index 80494f1..3c469c6 100644
--- a/OpenSim/Services/Interfaces/IAssetService.cs
+++ b/OpenSim/Services/Interfaces/IAssetService.cs
@@ -68,7 +68,11 @@ namespace OpenSim.Services.Interfaces
68 /// </summary> 68 /// </summary>
69 /// <param name="id">The asset id</param> 69 /// <param name="id">The asset id</param>
70 /// <param name="sender">Represents the requester. Passed back via the handler</param> 70 /// <param name="sender">Represents the requester. Passed back via the handler</param>
71 /// <param name="handler">The handler to call back once the asset has been retrieved</param> 71 /// <param name="handler">
72 /// The handler to call back once the asset has been retrieved. This will be called back with a null AssetBase
73 /// if the asset could not be found for some reason (e.g. if it does not exist, if a remote asset service
74 /// was not contactable, if it is not in the database, etc.).
75 /// </param>
72 /// <returns>True if the id was parseable, false otherwise</returns> 76 /// <returns>True if the id was parseable, false otherwise</returns>
73 bool Get(string id, Object sender, AssetRetrieved handler); 77 bool Get(string id, Object sender, AssetRetrieved handler);
74 78
diff --git a/OpenSim/Services/Interfaces/IGridService.cs b/OpenSim/Services/Interfaces/IGridService.cs
index cdcb961..3f4c958 100644
--- a/OpenSim/Services/Interfaces/IGridService.cs
+++ b/OpenSim/Services/Interfaces/IGridService.cs
@@ -100,6 +100,19 @@ namespace OpenSim.Services.Interfaces
100 List<GridRegion> GetFallbackRegions(UUID scopeID, int x, int y); 100 List<GridRegion> GetFallbackRegions(UUID scopeID, int x, int y);
101 List<GridRegion> GetHyperlinks(UUID scopeID); 101 List<GridRegion> GetHyperlinks(UUID scopeID);
102 102
103 /// <summary>
104 /// Get internal OpenSimulator region flags.
105 /// </summary>
106 /// <remarks>
107 /// See OpenSimulator.Framework.RegionFlags. These are not returned in the GridRegion structure -
108 /// they currently need to be requested separately. Possibly this should change to avoid multiple service calls
109 /// in some situations.
110 /// </remarks>
111 /// <returns>
112 /// The region flags.
113 /// </returns>
114 /// <param name='scopeID'></param>
115 /// <param name='regionID'></param>
103 int GetRegionFlags(UUID scopeID, UUID regionID); 116 int GetRegionFlags(UUID scopeID, UUID regionID);
104 } 117 }
105 118
diff --git a/OpenSim/Services/Interfaces/IGridUserService.cs b/OpenSim/Services/Interfaces/IGridUserService.cs
index 0a52bfa..2e7237e 100644
--- a/OpenSim/Services/Interfaces/IGridUserService.cs
+++ b/OpenSim/Services/Interfaces/IGridUserService.cs
@@ -80,7 +80,7 @@ namespace OpenSim.Services.Interfaces
80 80
81 } 81 }
82 82
83 public Dictionary<string, object> ToKeyValuePairs() 83 public virtual Dictionary<string, object> ToKeyValuePairs()
84 { 84 {
85 Dictionary<string, object> result = new Dictionary<string, object>(); 85 Dictionary<string, object> result = new Dictionary<string, object>();
86 result["UserID"] = UserID; 86 result["UserID"] = UserID;
@@ -96,7 +96,6 @@ namespace OpenSim.Services.Interfaces
96 result["Online"] = Online.ToString(); 96 result["Online"] = Online.ToString();
97 result["Login"] = Login.ToString(); 97 result["Login"] = Login.ToString();
98 result["Logout"] = Logout.ToString(); 98 result["Logout"] = Logout.ToString();
99
100 99
101 return result; 100 return result;
102 } 101 }
diff --git a/OpenSim/Services/Interfaces/IPresenceService.cs b/OpenSim/Services/Interfaces/IPresenceService.cs
index 8d583ff..90f9842 100644
--- a/OpenSim/Services/Interfaces/IPresenceService.cs
+++ b/OpenSim/Services/Interfaces/IPresenceService.cs
@@ -61,13 +61,49 @@ namespace OpenSim.Services.Interfaces
61 61
62 public interface IPresenceService 62 public interface IPresenceService
63 { 63 {
64 /// <summary>
65 /// Store session information.
66 /// </summary>
67 /// <returns>/returns>
68 /// <param name='userID'></param>
69 /// <param name='sessionID'></param>
70 /// <param name='secureSessionID'></param>
64 bool LoginAgent(string userID, UUID sessionID, UUID secureSessionID); 71 bool LoginAgent(string userID, UUID sessionID, UUID secureSessionID);
72
73 /// <summary>
74 /// Remove session information.
75 /// </summary>
76 /// <returns></returns>
77 /// <param name='sessionID'></param>
65 bool LogoutAgent(UUID sessionID); 78 bool LogoutAgent(UUID sessionID);
79
80 /// <summary>
81 /// Remove session information for all agents in the given region.
82 /// </summary>
83 /// <returns></returns>
84 /// <param name='regionID'></param>
66 bool LogoutRegionAgents(UUID regionID); 85 bool LogoutRegionAgents(UUID regionID);
67 86
87 /// <summary>
88 /// Update data for an existing session.
89 /// </summary>
90 /// <returns></returns>
91 /// <param name='sessionID'></param>
92 /// <param name='regionID'></param>
68 bool ReportAgent(UUID sessionID, UUID regionID); 93 bool ReportAgent(UUID sessionID, UUID regionID);
69 94
95 /// <summary>
96 /// Get session information for a given session ID.
97 /// </summary>
98 /// <returns></returns>
99 /// <param name='sessionID'></param>
70 PresenceInfo GetAgent(UUID sessionID); 100 PresenceInfo GetAgent(UUID sessionID);
101
102 /// <summary>
103 /// Get session information for a collection of users.
104 /// </summary>
105 /// <returns>Session information for the users.</returns>
106 /// <param name='userIDs'></param>
71 PresenceInfo[] GetAgents(string[] userIDs); 107 PresenceInfo[] GetAgents(string[] userIDs);
72 } 108 }
73} 109} \ No newline at end of file
diff --git a/OpenSim/Services/Interfaces/Properties/AssemblyInfo.cs b/OpenSim/Services/Interfaces/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..4723553
--- /dev/null
+++ b/OpenSim/Services/Interfaces/Properties/AssemblyInfo.cs
@@ -0,0 +1,33 @@
1using System.Reflection;
2using System.Runtime.CompilerServices;
3using System.Runtime.InteropServices;
4
5// General Information about an assembly is controlled through the following
6// set of attributes. Change these attribute values to modify the information
7// associated with an assembly.
8[assembly: AssemblyTitle("OpenSim.Services.Interfaces")]
9[assembly: AssemblyDescription("")]
10[assembly: AssemblyConfiguration("")]
11[assembly: AssemblyCompany("http://opensimulator.org")]
12[assembly: AssemblyProduct("OpenSim")]
13[assembly: AssemblyCopyright("OpenSimulator developers")]
14[assembly: AssemblyTrademark("")]
15[assembly: AssemblyCulture("")]
16
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
19// COM, set the ComVisible attribute to true on that type.
20[assembly: ComVisible(false)]
21
22// The following GUID is for the ID of the typelib if this project is exposed to COM
23[assembly: Guid("39091de1-1c4c-4ebe-bb01-31551ec1749d")]
24
25// Version information for an assembly consists of the following four values:
26//
27// Major Version
28// Minor Version
29// Build Number
30// Revision
31//
32[assembly: AssemblyVersion("0.7.5.*")]
33[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenSim/Services/InventoryService/InventoryService.cs b/OpenSim/Services/InventoryService/InventoryService.cs
deleted file mode 100644
index 73dd06a..0000000
--- a/OpenSim/Services/InventoryService/InventoryService.cs
+++ /dev/null
@@ -1,700 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using System.Reflection;
31using log4net;
32using Nini.Config;
33using OpenMetaverse;
34using OpenSim.Data;
35using OpenSim.Framework;
36using OpenSim.Services.Interfaces;
37
38namespace OpenSim.Services.InventoryService
39{
40 /// <summary>
41 /// The Inventory service reference implementation
42 /// </summary>
43 public class InventoryService : InventoryServiceBase, IInventoryService
44 {
45 private static readonly ILog m_log
46 = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
47
48 public InventoryService(IConfigSource config) : base(config)
49 {
50 m_log.Debug("[INVENTORY SERVICE]: Initialized.");
51 }
52
53 #region IInventoryServices methods
54
55 public string Host
56 {
57 get { return "default"; }
58 }
59
60 public List<InventoryFolderBase> GetInventorySkeleton(UUID userId)
61 {
62 m_log.DebugFormat("[INVENTORY SERVICE]: Getting inventory skeleton for {0}", userId);
63
64 InventoryFolderBase rootFolder = GetRootFolder(userId);
65
66 // Agent has no inventory structure yet.
67 if (null == rootFolder)
68 {
69 m_log.DebugFormat("[INVENTORY SERVICE]: No root folder");
70 return null;
71 }
72
73 List<InventoryFolderBase> userFolders = new List<InventoryFolderBase>();
74
75 userFolders.Add(rootFolder);
76
77 IList<InventoryFolderBase> folders = m_Database.getFolderHierarchy(rootFolder.ID);
78 userFolders.AddRange(folders);
79
80// m_log.DebugFormat("[INVENTORY SERVICE]: Got folder {0} {1}", folder.name, folder.folderID);
81
82 return userFolders;
83 }
84
85 public virtual bool HasInventoryForUser(UUID userID)
86 {
87 return false;
88 }
89
90 // See IInventoryServices
91 public virtual InventoryFolderBase GetRootFolder(UUID userID)
92 {
93 //m_log.DebugFormat("[INVENTORY SERVICE]: Getting root folder for {0}", userID);
94
95 // Retrieve the first root folder we get from the DB.
96 InventoryFolderBase rootFolder = m_Database.getUserRootFolder(userID);
97 if (rootFolder != null)
98 return rootFolder;
99
100 // Return nothing if the plugin was unable to supply a root folder
101 return null;
102 }
103
104 // See IInventoryServices
105 public bool CreateUserInventory(UUID user)
106 {
107 InventoryFolderBase existingRootFolder;
108 try
109 {
110 existingRootFolder = GetRootFolder(user);
111 }
112 catch /*(Exception e)*/
113 {
114 // Munch the exception, it has already been reported
115 //
116 return false;
117 }
118
119 if (null != existingRootFolder)
120 {
121 m_log.WarnFormat(
122 "[INVENTORY SERVICE]: Did not create a new inventory for user {0} since they already have "
123 + "a root inventory folder with id {1}",
124 user, existingRootFolder.ID);
125 }
126 else
127 {
128 UsersInventory inven = new UsersInventory();
129 inven.CreateNewInventorySet(user);
130 AddNewInventorySet(inven);
131
132 return true;
133 }
134
135 return false;
136 }
137
138 // See IInventoryServices
139
140 /// <summary>
141 /// Return a user's entire inventory synchronously
142 /// </summary>
143 /// <param name="rawUserID"></param>
144 /// <returns>The user's inventory. If an inventory cannot be found then an empty collection is returned.</returns>
145 public InventoryCollection GetUserInventory(UUID userID)
146 {
147 m_log.InfoFormat("[INVENTORY SERVICE]: Processing request for inventory of {0}", userID);
148
149 // Uncomment me to simulate a slow responding inventory server
150 //Thread.Sleep(16000);
151
152 InventoryCollection invCollection = new InventoryCollection();
153
154 List<InventoryFolderBase> allFolders = GetInventorySkeleton(userID);
155
156 if (null == allFolders)
157 {
158 m_log.WarnFormat("[INVENTORY SERVICE]: No inventory found for user {0}", userID);
159
160 return invCollection;
161 }
162
163 List<InventoryItemBase> allItems = new List<InventoryItemBase>();
164
165 foreach (InventoryFolderBase folder in allFolders)
166 {
167 List<InventoryItemBase> items = GetFolderItems(userID, folder.ID);
168
169 if (items != null)
170 {
171 allItems.InsertRange(0, items);
172 }
173 }
174
175 invCollection.UserID = userID;
176 invCollection.Folders = allFolders;
177 invCollection.Items = allItems;
178
179 // foreach (InventoryFolderBase folder in invCollection.Folders)
180 // {
181 // m_log.DebugFormat("[GRID INVENTORY SERVICE]: Sending back folder {0} {1}", folder.Name, folder.ID);
182 // }
183 //
184 // foreach (InventoryItemBase item in invCollection.Items)
185 // {
186 // m_log.DebugFormat("[GRID INVENTORY SERVICE]: Sending back item {0} {1}, folder {2}", item.Name, item.ID, item.Folder);
187 // }
188
189 m_log.InfoFormat(
190 "[INVENTORY SERVICE]: Sending back inventory response to user {0} containing {1} folders and {2} items",
191 invCollection.UserID, invCollection.Folders.Count, invCollection.Items.Count);
192
193 return invCollection;
194 }
195
196 /// <summary>
197 /// Asynchronous inventory fetch.
198 /// </summary>
199 /// <param name="userID"></param>
200 /// <param name="callback"></param>
201 public void GetUserInventory(UUID userID, InventoryReceiptCallback callback)
202 {
203 m_log.InfoFormat("[INVENTORY SERVICE]: Requesting inventory for user {0}", userID);
204
205 List<InventoryFolderImpl> folders = new List<InventoryFolderImpl>();
206 List<InventoryItemBase> items = new List<InventoryItemBase>();
207
208 List<InventoryFolderBase> skeletonFolders = GetInventorySkeleton(userID);
209
210 if (skeletonFolders != null)
211 {
212 InventoryFolderImpl rootFolder = null;
213
214 // Need to retrieve the root folder on the first pass
215 foreach (InventoryFolderBase folder in skeletonFolders)
216 {
217 if (folder.ParentID == UUID.Zero)
218 {
219 rootFolder = new InventoryFolderImpl(folder);
220 folders.Add(rootFolder);
221 items.AddRange(GetFolderItems(userID, rootFolder.ID));
222 break; // Only 1 root folder per user
223 }
224 }
225
226 if (rootFolder != null)
227 {
228 foreach (InventoryFolderBase folder in skeletonFolders)
229 {
230 if (folder.ID != rootFolder.ID)
231 {
232 folders.Add(new InventoryFolderImpl(folder));
233 items.AddRange(GetFolderItems(userID, folder.ID));
234 }
235 }
236 }
237
238 m_log.InfoFormat(
239 "[INVENTORY SERVICE]: Received inventory response for user {0} containing {1} folders and {2} items",
240 userID, folders.Count, items.Count);
241 }
242 else
243 {
244 m_log.WarnFormat("[INVENTORY SERVICE]: User {0} inventory not available", userID);
245 }
246
247 Util.FireAndForget(delegate { callback(folders, items); });
248 }
249
250 public InventoryCollection GetFolderContent(UUID userID, UUID folderID)
251 {
252 // Uncomment me to simulate a slow responding inventory server
253 //Thread.Sleep(16000);
254
255 InventoryCollection invCollection = new InventoryCollection();
256
257 List<InventoryItemBase> items = GetFolderItems(userID, folderID);
258 List<InventoryFolderBase> folders = RequestSubFolders(folderID);
259
260 invCollection.UserID = userID;
261 invCollection.Folders = folders;
262 invCollection.Items = items;
263
264 m_log.DebugFormat("[INVENTORY SERVICE]: Found {0} items and {1} folders in folder {2}", items.Count, folders.Count, folderID);
265
266 return invCollection;
267 }
268
269 public InventoryFolderBase GetFolderForType(UUID userID, AssetType type)
270 {
271// m_log.DebugFormat("[INVENTORY SERVICE]: Looking for folder type {0} for user {1}", type, userID);
272
273 InventoryFolderBase root = m_Database.getUserRootFolder(userID);
274 if (root != null)
275 {
276 List<InventoryFolderBase> folders = RequestSubFolders(root.ID);
277
278 foreach (InventoryFolderBase folder in folders)
279 {
280 if (folder.Type == (short)type)
281 {
282// m_log.DebugFormat(
283// "[INVENTORY SERVICE]: Found folder {0} type {1}", folder.Name, (AssetType)folder.Type);
284
285 return folder;
286 }
287 }
288 }
289
290 // we didn't find any folder of that type. Return the root folder
291 // hopefully the root folder is not null. If it is, too bad
292 return root;
293 }
294
295 public Dictionary<AssetType, InventoryFolderBase> GetSystemFolders(UUID userID)
296 {
297 InventoryFolderBase root = GetRootFolder(userID);
298 if (root != null)
299 {
300 InventoryCollection content = GetFolderContent(userID, root.ID);
301 if (content != null)
302 {
303 Dictionary<AssetType, InventoryFolderBase> folders = new Dictionary<AssetType, InventoryFolderBase>();
304 foreach (InventoryFolderBase folder in content.Folders)
305 {
306 if ((folder.Type != (short)AssetType.Folder) && (folder.Type != (short)AssetType.Unknown))
307 folders[(AssetType)folder.Type] = folder;
308 }
309 m_log.DebugFormat("[INVENTORY SERVICE]: Got {0} system folders for {1}", folders.Count, userID);
310 return folders;
311 }
312 }
313 m_log.WarnFormat("[INVENTORY SERVICE]: System folders for {0} not found", userID);
314 return new Dictionary<AssetType, InventoryFolderBase>();
315 }
316
317 public List<InventoryItemBase> GetActiveGestures(UUID userId)
318 {
319 List<InventoryItemBase> activeGestures = new List<InventoryItemBase>();
320 activeGestures.AddRange(m_Database.fetchActiveGestures(userId));
321
322 return activeGestures;
323 }
324
325 #endregion
326
327 #region Methods used by GridInventoryService
328
329 public List<InventoryFolderBase> RequestSubFolders(UUID parentFolderID)
330 {
331 List<InventoryFolderBase> inventoryList = new List<InventoryFolderBase>();
332
333 inventoryList.AddRange(m_Database.getInventoryFolders(parentFolderID));
334
335 return inventoryList;
336 }
337
338 public List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID)
339 {
340 List<InventoryItemBase> itemsList = new List<InventoryItemBase>();
341
342 itemsList.AddRange(m_Database.getInventoryInFolder(folderID));
343
344// m_log.DebugFormat(
345// "[INVENTORY SERVICE]: Found {0} items in folder {1} for {2}", itemsList.Count, folderID, userID);
346
347 return itemsList;
348 }
349
350 #endregion
351
352 // See IInventoryServices
353 public virtual bool AddFolder(InventoryFolderBase folder)
354 {
355 m_log.DebugFormat(
356 "[INVENTORY SERVICE]: Adding folder {0} {1} to folder {2}", folder.Name, folder.ID, folder.ParentID);
357
358 m_Database.addInventoryFolder(folder);
359
360 // FIXME: Should return false on failure
361 return true;
362 }
363
364 // See IInventoryServices
365 public virtual bool UpdateFolder(InventoryFolderBase folder)
366 {
367 m_log.DebugFormat(
368 "[INVENTORY SERVICE]: Updating folder {0} {1} to folder {2}", folder.Name, folder.ID, folder.ParentID);
369
370 m_Database.updateInventoryFolder(folder);
371
372 // FIXME: Should return false on failure
373 return true;
374 }
375
376 // See IInventoryServices
377 public virtual bool MoveFolder(InventoryFolderBase folder)
378 {
379 m_log.DebugFormat(
380 "[INVENTORY SERVICE]: Moving folder {0} {1} to folder {2}", folder.Name, folder.ID, folder.ParentID);
381
382 m_Database.moveInventoryFolder(folder);
383
384 // FIXME: Should return false on failure
385 return true;
386 }
387
388 // See IInventoryServices
389 public virtual bool AddItem(InventoryItemBase item)
390 {
391// m_log.DebugFormat(
392// "[INVENTORY SERVICE]: Adding item {0} {1} to folder {2} for {3}",
393// item.Name, item.ID, item.Folder, item.Owner);
394
395 m_Database.addInventoryItem(item);
396
397 // FIXME: Should return false on failure
398 return true;
399 }
400
401 // See IInventoryServices
402 public virtual bool UpdateItem(InventoryItemBase item)
403 {
404 m_log.InfoFormat(
405 "[INVENTORY SERVICE]: Updating item {0} {1} in folder {2}", item.Name, item.ID, item.Folder);
406
407 m_Database.updateInventoryItem(item);
408
409 // FIXME: Should return false on failure
410 return true;
411 }
412
413 public virtual bool MoveItems(UUID ownerID, List<InventoryItemBase> items)
414 {
415 m_log.InfoFormat(
416 "[INVENTORY SERVICE]: Moving {0} items from user {1}", items.Count, ownerID);
417
418 InventoryItemBase itm = null;
419 foreach (InventoryItemBase item in items)
420 {
421 itm = GetInventoryItem(item.ID);
422 itm.Folder = item.Folder;
423 if ((item.Name != null) && !item.Name.Equals(string.Empty))
424 itm.Name = item.Name;
425 m_Database.updateInventoryItem(itm);
426 }
427
428 return true;
429 }
430
431 // See IInventoryServices
432 public virtual bool DeleteItems(UUID owner, List<UUID> itemIDs)
433 {
434 m_log.InfoFormat(
435 "[INVENTORY SERVICE]: Deleting {0} items from user {1}", itemIDs.Count, owner);
436
437 // uhh.....
438 foreach (UUID uuid in itemIDs)
439 m_Database.deleteInventoryItem(uuid);
440
441 // FIXME: Should return false on failure
442 return true;
443 }
444
445 public virtual InventoryItemBase GetItem(InventoryItemBase item)
446 {
447 InventoryItemBase result = m_Database.getInventoryItem(item.ID);
448 if (result != null)
449 return result;
450 m_log.DebugFormat("[INVENTORY SERVICE]: GetItem failed to find item {0}", item.ID);
451 return null;
452 }
453
454 public virtual InventoryFolderBase GetFolder(InventoryFolderBase folder)
455 {
456 InventoryFolderBase result = m_Database.getInventoryFolder(folder.ID);
457 if (result != null)
458 return result;
459
460 m_log.DebugFormat("[INVENTORY SERVICE]: GetFolder failed to find folder {0}", folder.ID);
461 return null;
462 }
463
464 public virtual bool DeleteFolders(UUID ownerID, List<UUID> folderIDs)
465 {
466 m_log.InfoFormat("[INVENTORY SERVICE]: Deleting {0} folders from user {1}", folderIDs.Count, ownerID);
467 foreach (UUID id in folderIDs)
468 {
469 InventoryFolderBase folder = new InventoryFolderBase(id, ownerID);
470 PurgeFolder(folder);
471 m_Database.deleteInventoryFolder(id);
472 }
473 return true;
474 }
475
476 /// <summary>
477 /// Purge a folder of all items items and subfolders.
478 ///
479 /// FIXME: Really nasty in a sense, because we have to query the database to get information we may
480 /// already know... Needs heavy refactoring.
481 /// </summary>
482 /// <param name="folder"></param>
483 public virtual bool PurgeFolder(InventoryFolderBase folder)
484 {
485 m_log.DebugFormat(
486 "[INVENTORY SERVICE]: Purging folder {0} {1} of its contents", folder.Name, folder.ID);
487
488 List<InventoryFolderBase> subFolders = RequestSubFolders(folder.ID);
489
490 foreach (InventoryFolderBase subFolder in subFolders)
491 {
492// m_log.DebugFormat("[INVENTORY SERVICE]: Deleting folder {0} {1}", subFolder.Name, subFolder.ID);
493
494 m_Database.deleteInventoryFolder(subFolder.ID);
495 }
496
497 List<InventoryItemBase> items = GetFolderItems(folder.Owner, folder.ID);
498
499 List<UUID> uuids = new List<UUID>();
500 foreach (InventoryItemBase item in items)
501 {
502 uuids.Add(item.ID);
503 }
504 DeleteItems(folder.Owner, uuids);
505
506 // FIXME: Should return false on failure
507 return true;
508 }
509
510 private void AddNewInventorySet(UsersInventory inventory)
511 {
512 foreach (InventoryFolderBase folder in inventory.Folders.Values)
513 {
514 AddFolder(folder);
515 }
516 }
517
518 public InventoryItemBase GetInventoryItem(UUID itemID)
519 {
520 InventoryItemBase item = m_Database.getInventoryItem(itemID);
521 if (item != null)
522 return item;
523
524 return null;
525 }
526
527 public int GetAssetPermissions(UUID userID, UUID assetID)
528 {
529 InventoryFolderBase parent = GetRootFolder(userID);
530 return FindAssetPerms(parent, assetID);
531 }
532
533 private int FindAssetPerms(InventoryFolderBase folder, UUID assetID)
534 {
535 InventoryCollection contents = GetFolderContent(folder.Owner, folder.ID);
536
537 int perms = 0;
538 foreach (InventoryItemBase item in contents.Items)
539 {
540 if (item.AssetID == assetID)
541 perms = (int)item.CurrentPermissions | perms;
542 }
543
544 foreach (InventoryFolderBase subfolder in contents.Folders)
545 perms = perms | FindAssetPerms(subfolder, assetID);
546
547 return perms;
548 }
549
550 /// <summary>
551 /// Used to create a new user inventory.
552 /// </summary>
553 private class UsersInventory
554 {
555 public Dictionary<UUID, InventoryFolderBase> Folders = new Dictionary<UUID, InventoryFolderBase>();
556 public Dictionary<UUID, InventoryItemBase> Items = new Dictionary<UUID, InventoryItemBase>();
557
558 public virtual void CreateNewInventorySet(UUID user)
559 {
560 InventoryFolderBase folder = new InventoryFolderBase();
561
562 folder.ParentID = UUID.Zero;
563 folder.Owner = user;
564 folder.ID = UUID.Random();
565 folder.Name = "My Inventory";
566 folder.Type = (short)AssetType.Folder;
567 folder.Version = 1;
568 Folders.Add(folder.ID, folder);
569
570 UUID rootFolder = folder.ID;
571
572 folder = new InventoryFolderBase();
573 folder.ParentID = rootFolder;
574 folder.Owner = user;
575 folder.ID = UUID.Random();
576 folder.Name = "Animations";
577 folder.Type = (short)AssetType.Animation;
578 folder.Version = 1;
579 Folders.Add(folder.ID, folder);
580
581 folder = new InventoryFolderBase();
582 folder.ParentID = rootFolder;
583 folder.Owner = user;
584 folder.ID = UUID.Random();
585 folder.Name = "Body Parts";
586 folder.Type = (short)AssetType.Bodypart;
587 folder.Version = 1;
588 Folders.Add(folder.ID, folder);
589
590 folder = new InventoryFolderBase();
591 folder.ParentID = rootFolder;
592 folder.Owner = user;
593 folder.ID = UUID.Random();
594 folder.Name = "Calling Cards";
595 folder.Type = (short)AssetType.CallingCard;
596 folder.Version = 1;
597 Folders.Add(folder.ID, folder);
598
599 folder = new InventoryFolderBase();
600 folder.ParentID = rootFolder;
601 folder.Owner = user;
602 folder.ID = UUID.Random();
603 folder.Name = "Clothing";
604 folder.Type = (short)AssetType.Clothing;
605 folder.Version = 1;
606 Folders.Add(folder.ID, folder);
607
608 folder = new InventoryFolderBase();
609 folder.ParentID = rootFolder;
610 folder.Owner = user;
611 folder.ID = UUID.Random();
612 folder.Name = "Gestures";
613 folder.Type = (short)AssetType.Gesture;
614 folder.Version = 1;
615 Folders.Add(folder.ID, folder);
616
617 folder = new InventoryFolderBase();
618 folder.ParentID = rootFolder;
619 folder.Owner = user;
620 folder.ID = UUID.Random();
621 folder.Name = "Landmarks";
622 folder.Type = (short)AssetType.Landmark;
623 folder.Version = 1;
624 Folders.Add(folder.ID, folder);
625
626 folder = new InventoryFolderBase();
627 folder.ParentID = rootFolder;
628 folder.Owner = user;
629 folder.ID = UUID.Random();
630 folder.Name = "Lost And Found";
631 folder.Type = (short)AssetType.LostAndFoundFolder;
632 folder.Version = 1;
633 Folders.Add(folder.ID, folder);
634
635 folder = new InventoryFolderBase();
636 folder.ParentID = rootFolder;
637 folder.Owner = user;
638 folder.ID = UUID.Random();
639 folder.Name = "Notecards";
640 folder.Type = (short)AssetType.Notecard;
641 folder.Version = 1;
642 Folders.Add(folder.ID, folder);
643
644 folder = new InventoryFolderBase();
645 folder.ParentID = rootFolder;
646 folder.Owner = user;
647 folder.ID = UUID.Random();
648 folder.Name = "Objects";
649 folder.Type = (short)AssetType.Object;
650 folder.Version = 1;
651 Folders.Add(folder.ID, folder);
652
653 folder = new InventoryFolderBase();
654 folder.ParentID = rootFolder;
655 folder.Owner = user;
656 folder.ID = UUID.Random();
657 folder.Name = "Photo Album";
658 folder.Type = (short)AssetType.SnapshotFolder;
659 folder.Version = 1;
660 Folders.Add(folder.ID, folder);
661
662 folder = new InventoryFolderBase();
663 folder.ParentID = rootFolder;
664 folder.Owner = user;
665 folder.ID = UUID.Random();
666 folder.Name = "Scripts";
667 folder.Type = (short)AssetType.LSLText;
668 folder.Version = 1;
669 Folders.Add(folder.ID, folder);
670
671 folder = new InventoryFolderBase();
672 folder.ParentID = rootFolder;
673 folder.Owner = user;
674 folder.ID = UUID.Random();
675 folder.Name = "Sounds";
676 folder.Type = (short)AssetType.Sound;
677 folder.Version = 1;
678 Folders.Add(folder.ID, folder);
679
680 folder = new InventoryFolderBase();
681 folder.ParentID = rootFolder;
682 folder.Owner = user;
683 folder.ID = UUID.Random();
684 folder.Name = "Textures";
685 folder.Type = (short)AssetType.Texture;
686 folder.Version = 1;
687 Folders.Add(folder.ID, folder);
688
689 folder = new InventoryFolderBase();
690 folder.ParentID = rootFolder;
691 folder.Owner = user;
692 folder.ID = UUID.Random();
693 folder.Name = "Trash";
694 folder.Type = (short)AssetType.TrashFolder;
695 folder.Version = 1;
696 Folders.Add(folder.ID, folder);
697 }
698 }
699 }
700}
diff --git a/OpenSim/Services/InventoryService/Properties/AssemblyInfo.cs b/OpenSim/Services/InventoryService/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..41ad9f8
--- /dev/null
+++ b/OpenSim/Services/InventoryService/Properties/AssemblyInfo.cs
@@ -0,0 +1,33 @@
1using System.Reflection;
2using System.Runtime.CompilerServices;
3using System.Runtime.InteropServices;
4
5// General Information about an assembly is controlled through the following
6// set of attributes. Change these attribute values to modify the information
7// associated with an assembly.
8[assembly: AssemblyTitle("OpenSim.Services.InventoryService")]
9[assembly: AssemblyDescription("")]
10[assembly: AssemblyConfiguration("")]
11[assembly: AssemblyCompany("http://opensimulator.org")]
12[assembly: AssemblyProduct("OpenSim")]
13[assembly: AssemblyCopyright("OpenSimulator developers")]
14[assembly: AssemblyTrademark("")]
15[assembly: AssemblyCulture("")]
16
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
19// COM, set the ComVisible attribute to true on that type.
20[assembly: ComVisible(false)]
21
22// The following GUID is for the ID of the typelib if this project is exposed to COM
23[assembly: Guid("d96d6d8c-9769-47e7-88dc-dbeb8fe7105a")]
24
25// Version information for an assembly consists of the following four values:
26//
27// Major Version
28// Minor Version
29// Build Number
30// Revision
31//
32[assembly: AssemblyVersion("0.7.5.*")]
33[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenSim/Services/InventoryService/Tests/XInventoryServiceTests.cs b/OpenSim/Services/InventoryService/Tests/XInventoryServiceTests.cs
new file mode 100644
index 0000000..9e3fa69
--- /dev/null
+++ b/OpenSim/Services/InventoryService/Tests/XInventoryServiceTests.cs
@@ -0,0 +1,177 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using Nini.Config;
30using NUnit.Framework;
31using OpenMetaverse;
32using OpenSim.Framework;
33using OpenSim.Server.Base;
34using OpenSim.Services.Interfaces;
35using OpenSim.Tests.Common;
36
37namespace OpenSim.Services.InventoryService.Tests
38{
39 /// <summary>
40 /// Tests for the XInventoryService
41 /// </summary>
42 /// <remarks>
43 /// TODO: Fill out more tests.
44 /// </remarks>
45 [TestFixture]
46 public class XInventoryServiceTests : OpenSimTestCase
47 {
48 private IInventoryService CreateXInventoryService()
49 {
50 IConfigSource config = new IniConfigSource();
51 config.AddConfig("InventoryService");
52 config.Configs["InventoryService"].Set("StorageProvider", "OpenSim.Tests.Common.dll");
53
54 return ServerUtils.LoadPlugin<IInventoryService>(
55 "OpenSim.Services.InventoryService.dll:XInventoryService", new Object[] { config });
56 }
57
58 /// <summary>
59 /// Tests add item operation.
60 /// </summary>
61 /// <remarks>
62 /// TODO: Test all operations.
63 /// </remarks>
64 [Test]
65 public void TestAddItem()
66 {
67 TestHelpers.InMethod();
68
69 string creatorId = TestHelpers.ParseTail(0x1).ToString();
70 UUID ownerId = TestHelpers.ParseTail(0x2);
71 UUID itemId = TestHelpers.ParseTail(0x10);
72 UUID assetId = TestHelpers.ParseTail(0x20);
73 UUID folderId = TestHelpers.ParseTail(0x30);
74 int invType = (int)InventoryType.Animation;
75 int assetType = (int)AssetType.Animation;
76 string itemName = "item1";
77
78 IInventoryService xis = CreateXInventoryService();
79
80 InventoryItemBase itemToStore
81 = new InventoryItemBase(itemId, ownerId)
82 {
83 CreatorIdentification = creatorId.ToString(),
84 AssetID = assetId,
85 Name = itemName,
86 Folder = folderId,
87 InvType = invType,
88 AssetType = assetType
89 };
90
91 Assert.That(xis.AddItem(itemToStore), Is.True);
92
93 InventoryItemBase itemRetrieved = new InventoryItemBase(itemId);
94 itemRetrieved = xis.GetItem(itemRetrieved);
95
96 Assert.That(itemRetrieved, Is.Not.Null);
97 Assert.That(itemRetrieved.CreatorId, Is.EqualTo(creatorId));
98 Assert.That(itemRetrieved.Owner, Is.EqualTo(ownerId));
99 Assert.That(itemRetrieved.AssetID, Is.EqualTo(assetId));
100 Assert.That(itemRetrieved.Folder, Is.EqualTo(folderId));
101 Assert.That(itemRetrieved.InvType, Is.EqualTo(invType));
102 Assert.That(itemRetrieved.AssetType, Is.EqualTo(assetType));
103 Assert.That(itemRetrieved.Name, Is.EqualTo(itemName));
104 }
105
106 [Test]
107 public void TestUpdateItem()
108 {
109 TestHelpers.InMethod();
110// TestHelpers.EnableLogging();
111
112 string creatorId = TestHelpers.ParseTail(0x1).ToString();
113 UUID ownerId = TestHelpers.ParseTail(0x2);
114 UUID itemId = TestHelpers.ParseTail(0x10);
115 UUID assetId = TestHelpers.ParseTail(0x20);
116 UUID folderId = TestHelpers.ParseTail(0x30);
117 int invType = (int)InventoryType.Animation;
118 int assetType = (int)AssetType.Animation;
119 string itemName = "item1";
120 string itemName2 = "item2";
121
122 IInventoryService xis = CreateXInventoryService();
123
124 InventoryItemBase itemToStore
125 = new InventoryItemBase(itemId, ownerId)
126 {
127 CreatorIdentification = creatorId.ToString(),
128 AssetID = assetId,
129 Name = itemName,
130 Folder = folderId,
131 InvType = invType,
132 AssetType = assetType
133 };
134
135 Assert.That(xis.AddItem(itemToStore), Is.True);
136
137 // Normal update
138 itemToStore.Name = itemName2;
139
140 Assert.That(xis.UpdateItem(itemToStore), Is.True);
141
142 InventoryItemBase itemRetrieved = new InventoryItemBase(itemId);
143 itemRetrieved = xis.GetItem(itemRetrieved);
144
145 Assert.That(itemRetrieved, Is.Not.Null);
146 Assert.That(itemRetrieved.Name, Is.EqualTo(itemName2));
147
148 // Attempt to update properties that should never change
149 string creatorId2 = TestHelpers.ParseTail(0x7).ToString();
150 UUID ownerId2 = TestHelpers.ParseTail(0x8);
151 UUID folderId2 = TestHelpers.ParseTail(0x70);
152 int invType2 = (int)InventoryType.CallingCard;
153 int assetType2 = (int)AssetType.CallingCard;
154 string itemName3 = "item3";
155
156 itemToStore.CreatorIdentification = creatorId2.ToString();
157 itemToStore.Owner = ownerId2;
158 itemToStore.Folder = folderId2;
159 itemToStore.InvType = invType2;
160 itemToStore.AssetType = assetType2;
161 itemToStore.Name = itemName3;
162
163 Assert.That(xis.UpdateItem(itemToStore), Is.True);
164
165 itemRetrieved = xis.GetItem(itemRetrieved);
166
167 Assert.That(itemRetrieved, Is.Not.Null);
168 Assert.That(itemRetrieved.CreatorId, Is.EqualTo(creatorId));
169 Assert.That(itemRetrieved.Owner, Is.EqualTo(ownerId));
170 Assert.That(itemRetrieved.AssetID, Is.EqualTo(assetId));
171 Assert.That(itemRetrieved.Folder, Is.EqualTo(folderId));
172 Assert.That(itemRetrieved.InvType, Is.EqualTo(invType));
173 Assert.That(itemRetrieved.AssetType, Is.EqualTo(assetType));
174 Assert.That(itemRetrieved.Name, Is.EqualTo(itemName3));
175 }
176 }
177} \ No newline at end of file
diff --git a/OpenSim/Services/InventoryService/XInventoryService.cs b/OpenSim/Services/InventoryService/XInventoryService.cs
index 7518b86..00faa44 100644
--- a/OpenSim/Services/InventoryService/XInventoryService.cs
+++ b/OpenSim/Services/InventoryService/XInventoryService.cs
@@ -94,6 +94,7 @@ namespace OpenSim.Services.InventoryService
94 94
95 m_Database = LoadPlugin<IXInventoryData>(dllName, 95 m_Database = LoadPlugin<IXInventoryData>(dllName,
96 new Object[] {connString, String.Empty}); 96 new Object[] {connString, String.Empty});
97
97 if (m_Database == null) 98 if (m_Database == null)
98 throw new Exception("Could not find a storage interface in the given module"); 99 throw new Exception("Could not find a storage interface in the given module");
99 } 100 }
@@ -229,10 +230,28 @@ namespace OpenSim.Services.InventoryService
229 public virtual InventoryFolderBase GetFolderForType(UUID principalID, AssetType type) 230 public virtual InventoryFolderBase GetFolderForType(UUID principalID, AssetType type)
230 { 231 {
231// m_log.DebugFormat("[XINVENTORY SERVICE]: Getting folder type {0} for user {1}", type, principalID); 232// m_log.DebugFormat("[XINVENTORY SERVICE]: Getting folder type {0} for user {1}", type, principalID);
233
234 InventoryFolderBase rootFolder = GetRootFolder(principalID);
235
236 if (rootFolder == null)
237 {
238 m_log.WarnFormat(
239 "[XINVENTORY]: Found no root folder for {0} in GetFolderForType() when looking for {1}",
240 principalID, type);
241
242 return null;
243 }
244
245 return GetSystemFolderForType(rootFolder, type);
246 }
247
248 private InventoryFolderBase GetSystemFolderForType(InventoryFolderBase rootFolder, AssetType type)
249 {
250// m_log.DebugFormat("[XINVENTORY SERVICE]: Getting folder type {0} for user {1}", type, principalID);
232 251
233 XInventoryFolder[] folders = m_Database.GetFolders( 252 XInventoryFolder[] folders = m_Database.GetFolders(
234 new string[] { "agentID", "type"}, 253 new string[] { "agentID", "parentFolderID", "type"},
235 new string[] { principalID.ToString(), ((int)type).ToString() }); 254 new string[] { rootFolder.Owner.ToString(), rootFolder.ID.ToString(), ((int)type).ToString() });
236 255
237 if (folders.Length == 0) 256 if (folders.Length == 0)
238 { 257 {
@@ -308,22 +327,38 @@ namespace OpenSim.Services.InventoryService
308 if (check != null) 327 if (check != null)
309 return false; 328 return false;
310 329
311 if (folder.Type == (short)AssetType.Folder 330 if (folder.Type != (short)AssetType.Folder && folder.Type != (short)AssetType.Unknown)
312 || folder.Type == (short)AssetType.Unknown
313 || folder.Type == (short)AssetType.OutfitFolder
314 || GetFolderForType(folder.Owner, (AssetType)(folder.Type)) == null)
315 { 331 {
316 XInventoryFolder xFolder = ConvertFromOpenSim(folder); 332 InventoryFolderBase rootFolder = GetRootFolder(folder.Owner);
317 return m_Database.StoreFolder(xFolder); 333
318 } 334 if (rootFolder == null)
319 else 335 {
320 { 336 m_log.WarnFormat(
321 m_log.WarnFormat( 337 "[XINVENTORY]: Found no root folder for {0} in AddFolder() when looking for {1}",
322 "[XINVENTORY]: Folder of type {0} already exists when tried to add {1} to {2} for {3}", 338 folder.Owner, folder.Type);
323 folder.Type, folder.Name, folder.ParentID, folder.Owner); 339
340 return false;
341 }
342
343 // Check we're not trying to add this as a system folder.
344 if (folder.ParentID == rootFolder.ID)
345 {
346 InventoryFolderBase existingSystemFolder
347 = GetSystemFolderForType(rootFolder, (AssetType)folder.Type);
348
349 if (existingSystemFolder != null)
350 {
351 m_log.WarnFormat(
352 "[XINVENTORY]: System folder of type {0} already exists when tried to add {1} to {2} for {3}",
353 folder.Type, folder.Name, folder.ParentID, folder.Owner);
354
355 return false;
356 }
357 }
324 } 358 }
325 359
326 return false; 360 XInventoryFolder xFolder = ConvertFromOpenSim(folder);
361 return m_Database.StoreFolder(xFolder);
327 } 362 }
328 363
329 public virtual bool UpdateFolder(InventoryFolderBase folder) 364 public virtual bool UpdateFolder(InventoryFolderBase folder)
@@ -365,16 +400,7 @@ namespace OpenSim.Services.InventoryService
365 400
366 public virtual bool MoveFolder(InventoryFolderBase folder) 401 public virtual bool MoveFolder(InventoryFolderBase folder)
367 { 402 {
368 XInventoryFolder[] x = m_Database.GetFolders( 403 return m_Database.MoveFolder(folder.ID.ToString(), folder.ParentID.ToString());
369 new string[] { "folderID" },
370 new string[] { folder.ID.ToString() });
371
372 if (x.Length == 0)
373 return false;
374
375 x[0].parentFolderID = folder.ParentID;
376
377 return m_Database.StoreFolder(x[0]);
378 } 404 }
379 405
380 // We don't check the principal's ID here 406 // We don't check the principal's ID here
@@ -450,6 +476,46 @@ namespace OpenSim.Services.InventoryService
450// m_log.InfoFormat( 476// m_log.InfoFormat(
451// "[XINVENTORY SERVICE]: Updating item {0} {1} in folder {2}", item.Name, item.ID, item.Folder); 477// "[XINVENTORY SERVICE]: Updating item {0} {1} in folder {2}", item.Name, item.ID, item.Folder);
452 478
479 InventoryItemBase retrievedItem = GetItem(item);
480
481 if (retrievedItem == null)
482 {
483 m_log.WarnFormat(
484 "[XINVENTORY SERVICE]: Tried to update item {0} {1}, owner {2} but no existing item found.",
485 item.Name, item.ID, item.Owner);
486
487 return false;
488 }
489
490 // Do not allow invariants to change. Changes to folder ID occur in MoveItems()
491 if (retrievedItem.InvType != item.InvType
492 || retrievedItem.AssetType != item.AssetType
493 || retrievedItem.Folder != item.Folder
494 || retrievedItem.CreatorIdentification != item.CreatorIdentification
495 || retrievedItem.Owner != item.Owner)
496 {
497 m_log.WarnFormat(
498 "[XINVENTORY SERVICE]: Caller to UpdateItem() for {0} {1} tried to alter property(s) that should be invariant, (InvType, AssetType, Folder, CreatorIdentification, Owner), existing ({2}, {3}, {4}, {5}, {6}), update ({7}, {8}, {9}, {10}, {11})",
499 retrievedItem.Name,
500 retrievedItem.ID,
501 retrievedItem.InvType,
502 retrievedItem.AssetType,
503 retrievedItem.Folder,
504 retrievedItem.CreatorIdentification,
505 retrievedItem.Owner,
506 item.InvType,
507 item.AssetType,
508 item.Folder,
509 item.CreatorIdentification,
510 item.Owner);
511
512 item.InvType = retrievedItem.InvType;
513 item.AssetType = retrievedItem.AssetType;
514 item.Folder = retrievedItem.Folder;
515 item.CreatorIdentification = retrievedItem.CreatorIdentification;
516 item.Owner = retrievedItem.Owner;
517 }
518
453 return m_Database.StoreItem(ConvertFromOpenSim(item)); 519 return m_Database.StoreItem(ConvertFromOpenSim(item));
454 } 520 }
455 521
diff --git a/OpenSim/Services/LLLoginService/LLLoginService.cs b/OpenSim/Services/LLLoginService/LLLoginService.cs
index 988a9b9..cbb6e6c 100644
--- a/OpenSim/Services/LLLoginService/LLLoginService.cs
+++ b/OpenSim/Services/LLLoginService/LLLoginService.cs
@@ -300,7 +300,7 @@ namespace OpenSim.Services.LLLoginService
300 { 300 {
301 m_log.InfoFormat( 301 m_log.InfoFormat(
302 "[LLOGIN SERVICE]: Login failed for {0} {1}, reason: user level is {2} but minimum login level is {3}", 302 "[LLOGIN SERVICE]: Login failed for {0} {1}, reason: user level is {2} but minimum login level is {3}",
303 firstName, lastName, m_MinLoginLevel, account.UserLevel); 303 firstName, lastName, account.UserLevel, m_MinLoginLevel);
304 return LLFailedLoginResponse.LoginBlockedProblem; 304 return LLFailedLoginResponse.LoginBlockedProblem;
305 } 305 }
306 306
diff --git a/OpenSim/Services/LLLoginService/Properties/AssemblyInfo.cs b/OpenSim/Services/LLLoginService/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..62c6e0f
--- /dev/null
+++ b/OpenSim/Services/LLLoginService/Properties/AssemblyInfo.cs
@@ -0,0 +1,33 @@
1using System.Reflection;
2using System.Runtime.CompilerServices;
3using System.Runtime.InteropServices;
4
5// General Information about an assembly is controlled through the following
6// set of attributes. Change these attribute values to modify the information
7// associated with an assembly.
8[assembly: AssemblyTitle("OpenSim.Services.LLLoginService")]
9[assembly: AssemblyDescription("")]
10[assembly: AssemblyConfiguration("")]
11[assembly: AssemblyCompany("http://opensimulator.org")]
12[assembly: AssemblyProduct("OpenSim")]
13[assembly: AssemblyCopyright("OpenSimulator developers")]
14[assembly: AssemblyTrademark("")]
15[assembly: AssemblyCulture("")]
16
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
19// COM, set the ComVisible attribute to true on that type.
20[assembly: ComVisible(false)]
21
22// The following GUID is for the ID of the typelib if this project is exposed to COM
23[assembly: Guid("cbeb8f23-3896-4076-97fd-f955b0af6a93")]
24
25// Version information for an assembly consists of the following four values:
26//
27// Major Version
28// Minor Version
29// Build Number
30// Revision
31//
32[assembly: AssemblyVersion("0.7.5.*")]
33[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenSim/Services/MapImageService/Properties/AssemblyInfo.cs b/OpenSim/Services/MapImageService/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..23eb664
--- /dev/null
+++ b/OpenSim/Services/MapImageService/Properties/AssemblyInfo.cs
@@ -0,0 +1,33 @@
1using System.Reflection;
2using System.Runtime.CompilerServices;
3using System.Runtime.InteropServices;
4
5// General Information about an assembly is controlled through the following
6// set of attributes. Change these attribute values to modify the information
7// associated with an assembly.
8[assembly: AssemblyTitle("OpenSim.Services.MapImageService")]
9[assembly: AssemblyDescription("")]
10[assembly: AssemblyConfiguration("")]
11[assembly: AssemblyCompany("http://opensimulator.org")]
12[assembly: AssemblyProduct("OpenSim")]
13[assembly: AssemblyCopyright("OpenSimulator developers")]
14[assembly: AssemblyTrademark("")]
15[assembly: AssemblyCulture("")]
16
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
19// COM, set the ComVisible attribute to true on that type.
20[assembly: ComVisible(false)]
21
22// The following GUID is for the ID of the typelib if this project is exposed to COM
23[assembly: Guid("5e679df7-1d2a-401a-8966-b93677bb5839")]
24
25// Version information for an assembly consists of the following four values:
26//
27// Major Version
28// Minor Version
29// Build Number
30// Revision
31//
32[assembly: AssemblyVersion("0.7.5.*")]
33[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenSim/Services/PresenceService/Properties/AssemblyInfo.cs b/OpenSim/Services/PresenceService/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..8c03dd7
--- /dev/null
+++ b/OpenSim/Services/PresenceService/Properties/AssemblyInfo.cs
@@ -0,0 +1,33 @@
1using System.Reflection;
2using System.Runtime.CompilerServices;
3using System.Runtime.InteropServices;
4
5// General Information about an assembly is controlled through the following
6// set of attributes. Change these attribute values to modify the information
7// associated with an assembly.
8[assembly: AssemblyTitle("OpenSim.Services.PresenceService")]
9[assembly: AssemblyDescription("")]
10[assembly: AssemblyConfiguration("")]
11[assembly: AssemblyCompany("http://opensimulator.org")]
12[assembly: AssemblyProduct("OpenSim")]
13[assembly: AssemblyCopyright("OpenSimulator developers")]
14[assembly: AssemblyTrademark("")]
15[assembly: AssemblyCulture("")]
16
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
19// COM, set the ComVisible attribute to true on that type.
20[assembly: ComVisible(false)]
21
22// The following GUID is for the ID of the typelib if this project is exposed to COM
23[assembly: Guid("a875a0bd-eab0-40a2-b5c4-3afddc3b4d2d")]
24
25// Version information for an assembly consists of the following four values:
26//
27// Major Version
28// Minor Version
29// Build Number
30// Revision
31//
32[assembly: AssemblyVersion("0.7.5.*")]
33[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenSim/Services/UserAccountService/GridUserService.cs b/OpenSim/Services/UserAccountService/GridUserService.cs
index ac3d8fd..43fa04b 100644
--- a/OpenSim/Services/UserAccountService/GridUserService.cs
+++ b/OpenSim/Services/UserAccountService/GridUserService.cs
@@ -49,7 +49,7 @@ namespace OpenSim.Services.UserAccountService
49 m_log.Debug("[USER GRID SERVICE]: Starting user grid service"); 49 m_log.Debug("[USER GRID SERVICE]: Starting user grid service");
50 } 50 }
51 51
52 public GridUserInfo GetGridUserInfo(string userID) 52 public virtual GridUserInfo GetGridUserInfo(string userID)
53 { 53 {
54 GridUserData d = m_Database.Get(userID); 54 GridUserData d = m_Database.Get(userID);
55 55
@@ -122,17 +122,6 @@ namespace OpenSim.Services.UserAccountService
122 return m_Database.Store(d); 122 return m_Database.Store(d);
123 } 123 }
124 124
125 protected bool StoreGridUserInfo(GridUserInfo info)
126 {
127 GridUserData d = new GridUserData();
128
129 d.Data["HomeRegionID"] = info.HomeRegionID.ToString();
130 d.Data["HomePosition"] = info.HomePosition.ToString();
131 d.Data["HomeLookAt"] = info.HomeLookAt.ToString();
132
133 return m_Database.Store(d);
134 }
135
136 public bool SetHome(string userID, UUID homeID, Vector3 homePosition, Vector3 homeLookAt) 125 public bool SetHome(string userID, UUID homeID, Vector3 homePosition, Vector3 homeLookAt)
137 { 126 {
138 GridUserData d = m_Database.Get(userID); 127 GridUserData d = m_Database.Get(userID);
diff --git a/OpenSim/Services/UserAccountService/Properties/AssemblyInfo.cs b/OpenSim/Services/UserAccountService/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..24e1d16
--- /dev/null
+++ b/OpenSim/Services/UserAccountService/Properties/AssemblyInfo.cs
@@ -0,0 +1,33 @@
1using System.Reflection;
2using System.Runtime.CompilerServices;
3using System.Runtime.InteropServices;
4
5// General Information about an assembly is controlled through the following
6// set of attributes. Change these attribute values to modify the information
7// associated with an assembly.
8[assembly: AssemblyTitle("OpenSim.Services.UserAccountService")]
9[assembly: AssemblyDescription("")]
10[assembly: AssemblyConfiguration("")]
11[assembly: AssemblyCompany("http://opensimulator.org")]
12[assembly: AssemblyProduct("OpenSim")]
13[assembly: AssemblyCopyright("OpenSimulator developers")]
14[assembly: AssemblyTrademark("")]
15[assembly: AssemblyCulture("")]
16
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
19// COM, set the ComVisible attribute to true on that type.
20[assembly: ComVisible(false)]
21
22// The following GUID is for the ID of the typelib if this project is exposed to COM
23[assembly: Guid("fdb4771d-9928-4db4-aeb5-90cac2976584")]
24
25// Version information for an assembly consists of the following four values:
26//
27// Major Version
28// Minor Version
29// Build Number
30// Revision
31//
32[assembly: AssemblyVersion("0.7.5.*")]
33[assembly: AssemblyFileVersion("1.0.0.0")]