diff options
Diffstat (limited to 'OpenSim')
30 files changed, 1420 insertions, 233 deletions
diff --git a/OpenSim/Data/Migration.cs b/OpenSim/Data/Migration.cs index 0fb9e78..06defe4 100644 --- a/OpenSim/Data/Migration.cs +++ b/OpenSim/Data/Migration.cs | |||
@@ -53,8 +53,8 @@ namespace OpenSim.Data | |||
53 | /// When a database driver starts up, it specifies a resource that | 53 | /// When a database driver starts up, it specifies a resource that |
54 | /// needs to be brought up to the current revision. For instance: | 54 | /// needs to be brought up to the current revision. For instance: |
55 | /// | 55 | /// |
56 | /// Migration um = new Migration(Assembly, DbConnection, "Users"); | 56 | /// Migration um = new Migration(DbConnection, Assembly, "Users"); |
57 | /// um.Upgrade(); | 57 | /// um.Update(); |
58 | /// | 58 | /// |
59 | /// This works out which version Users is at, and applies all the | 59 | /// This works out which version Users is at, and applies all the |
60 | /// revisions past it to it. If there is no users table, all | 60 | /// revisions past it to it. If there is no users table, all |
@@ -110,10 +110,11 @@ namespace OpenSim.Data | |||
110 | return; | 110 | return; |
111 | 111 | ||
112 | // If not, create the migration tables | 112 | // If not, create the migration tables |
113 | DbCommand cmd = _conn.CreateCommand(); | 113 | using (DbCommand cmd = _conn.CreateCommand()) |
114 | cmd.CommandText = _migrations_create; | 114 | { |
115 | cmd.ExecuteNonQuery(); | 115 | cmd.CommandText = _migrations_create; |
116 | cmd.Dispose(); | 116 | cmd.ExecuteNonQuery(); |
117 | } | ||
117 | 118 | ||
118 | InsertVersion("migrations", 1); | 119 | InsertVersion("migrations", 1); |
119 | } | 120 | } |
@@ -131,37 +132,37 @@ namespace OpenSim.Data | |||
131 | m_log.InfoFormat("[MIGRATIONS] Upgrading {0} to latest revision {1}.", _type, migrations.Keys[migrations.Count - 1]); | 132 | m_log.InfoFormat("[MIGRATIONS] Upgrading {0} to latest revision {1}.", _type, migrations.Keys[migrations.Count - 1]); |
132 | m_log.Info("[MIGRATIONS] NOTE: this may take a while, don't interupt this process!"); | 133 | m_log.Info("[MIGRATIONS] NOTE: this may take a while, don't interupt this process!"); |
133 | 134 | ||
134 | DbCommand cmd = _conn.CreateCommand(); | 135 | using (DbCommand cmd = _conn.CreateCommand()) |
135 | foreach (KeyValuePair<int, string> kvp in migrations) | ||
136 | { | 136 | { |
137 | int newversion = kvp.Key; | 137 | foreach (KeyValuePair<int, string> kvp in migrations) |
138 | cmd.CommandText = kvp.Value; | ||
139 | // we need to up the command timeout to infinite as we might be doing long migrations. | ||
140 | cmd.CommandTimeout = 0; | ||
141 | try | ||
142 | { | ||
143 | cmd.ExecuteNonQuery(); | ||
144 | } | ||
145 | catch (Exception e) | ||
146 | { | 138 | { |
147 | m_log.DebugFormat("[MIGRATIONS] Cmd was {0}", cmd.CommandText); | 139 | int newversion = kvp.Key; |
148 | m_log.DebugFormat("[MIGRATIONS]: An error has occurred in the migration {0}.\n This may mean you could see errors trying to run OpenSim. If you see database related errors, you will need to fix the issue manually. Continuing.", e.Message); | 140 | cmd.CommandText = kvp.Value; |
149 | cmd.CommandText = "ROLLBACK;"; | 141 | // we need to up the command timeout to infinite as we might be doing long migrations. |
150 | cmd.ExecuteNonQuery(); | 142 | cmd.CommandTimeout = 0; |
151 | } | 143 | try |
144 | { | ||
145 | cmd.ExecuteNonQuery(); | ||
146 | } | ||
147 | catch (Exception e) | ||
148 | { | ||
149 | m_log.DebugFormat("[MIGRATIONS] Cmd was {0}", cmd.CommandText); | ||
150 | m_log.DebugFormat("[MIGRATIONS]: An error has occurred in the migration {0}.\n This may mean you could see errors trying to run OpenSim. If you see database related errors, you will need to fix the issue manually. Continuing.", e.Message); | ||
151 | cmd.CommandText = "ROLLBACK;"; | ||
152 | cmd.ExecuteNonQuery(); | ||
153 | } | ||
152 | 154 | ||
153 | if (version == 0) | 155 | if (version == 0) |
154 | { | 156 | { |
155 | InsertVersion(_type, newversion); | 157 | InsertVersion(_type, newversion); |
156 | } | 158 | } |
157 | else | 159 | else |
158 | { | 160 | { |
159 | UpdateVersion(_type, newversion); | 161 | UpdateVersion(_type, newversion); |
162 | } | ||
163 | version = newversion; | ||
160 | } | 164 | } |
161 | version = newversion; | ||
162 | } | 165 | } |
163 | |||
164 | cmd.Dispose(); | ||
165 | } | 166 | } |
166 | 167 | ||
167 | // private int MaxVersion() | 168 | // private int MaxVersion() |
@@ -200,43 +201,46 @@ namespace OpenSim.Data | |||
200 | protected virtual int FindVersion(DbConnection conn, string type) | 201 | protected virtual int FindVersion(DbConnection conn, string type) |
201 | { | 202 | { |
202 | int version = 0; | 203 | int version = 0; |
203 | DbCommand cmd = conn.CreateCommand(); | 204 | using (DbCommand cmd = conn.CreateCommand()) |
204 | try | ||
205 | { | 205 | { |
206 | cmd.CommandText = "select version from migrations where name='" + type +"' order by version desc"; | 206 | try |
207 | using (IDataReader reader = cmd.ExecuteReader()) | ||
208 | { | 207 | { |
209 | if (reader.Read()) | 208 | cmd.CommandText = "select version from migrations where name='" + type + "' order by version desc"; |
209 | using (IDataReader reader = cmd.ExecuteReader()) | ||
210 | { | 210 | { |
211 | version = Convert.ToInt32(reader["version"]); | 211 | if (reader.Read()) |
212 | { | ||
213 | version = Convert.ToInt32(reader["version"]); | ||
214 | } | ||
215 | reader.Close(); | ||
212 | } | 216 | } |
213 | reader.Close(); | 217 | } |
218 | catch | ||
219 | { | ||
220 | // Something went wrong, so we're version 0 | ||
214 | } | 221 | } |
215 | } | 222 | } |
216 | catch | ||
217 | { | ||
218 | // Something went wrong, so we're version 0 | ||
219 | } | ||
220 | cmd.Dispose(); | ||
221 | return version; | 223 | return version; |
222 | } | 224 | } |
223 | 225 | ||
224 | private void InsertVersion(string type, int version) | 226 | private void InsertVersion(string type, int version) |
225 | { | 227 | { |
226 | DbCommand cmd = _conn.CreateCommand(); | 228 | using (DbCommand cmd = _conn.CreateCommand()) |
227 | cmd.CommandText = "insert into migrations(name, version) values('" + type + "', " + version + ")"; | 229 | { |
228 | m_log.InfoFormat("[MIGRATIONS]: Creating {0} at version {1}", type, version); | 230 | cmd.CommandText = "insert into migrations(name, version) values('" + type + "', " + version + ")"; |
229 | cmd.ExecuteNonQuery(); | 231 | m_log.InfoFormat("[MIGRATIONS]: Creating {0} at version {1}", type, version); |
230 | cmd.Dispose(); | 232 | cmd.ExecuteNonQuery(); |
233 | } | ||
231 | } | 234 | } |
232 | 235 | ||
233 | private void UpdateVersion(string type, int version) | 236 | private void UpdateVersion(string type, int version) |
234 | { | 237 | { |
235 | DbCommand cmd = _conn.CreateCommand(); | 238 | using (DbCommand cmd = _conn.CreateCommand()) |
236 | cmd.CommandText = "update migrations set version=" + version + " where name='" + type + "'"; | 239 | { |
237 | m_log.InfoFormat("[MIGRATIONS]: Updating {0} to version {1}", type, version); | 240 | cmd.CommandText = "update migrations set version=" + version + " where name='" + type + "'"; |
238 | cmd.ExecuteNonQuery(); | 241 | m_log.InfoFormat("[MIGRATIONS]: Updating {0} to version {1}", type, version); |
239 | cmd.Dispose(); | 242 | cmd.ExecuteNonQuery(); |
243 | } | ||
240 | } | 244 | } |
241 | 245 | ||
242 | // private SortedList<int, string> GetAllMigrations() | 246 | // private SortedList<int, string> GetAllMigrations() |
diff --git a/OpenSim/Data/MySQL/MySQLInventoryData.cs b/OpenSim/Data/MySQL/MySQLInventoryData.cs index 192deb2..e0e9b9c 100644 --- a/OpenSim/Data/MySQL/MySQLInventoryData.cs +++ b/OpenSim/Data/MySQL/MySQLInventoryData.cs | |||
@@ -145,7 +145,7 @@ namespace OpenSim.Data.MySQL | |||
145 | /// <summary> | 145 | /// <summary> |
146 | /// Returns a list of the root folders within a users inventory | 146 | /// Returns a list of the root folders within a users inventory |
147 | /// </summary> | 147 | /// </summary> |
148 | /// <param name="user">The user whos inventory is to be searched</param> | 148 | /// <param name="user">The user whose inventory is to be searched</param> |
149 | /// <returns>A list of folder objects</returns> | 149 | /// <returns>A list of folder objects</returns> |
150 | public List<InventoryFolderBase> getUserRootFolders(UUID user) | 150 | public List<InventoryFolderBase> getUserRootFolders(UUID user) |
151 | { | 151 | { |
@@ -284,7 +284,7 @@ namespace OpenSim.Data.MySQL | |||
284 | { | 284 | { |
285 | InventoryItemBase item = new InventoryItemBase(); | 285 | InventoryItemBase item = new InventoryItemBase(); |
286 | 286 | ||
287 | // TODO: this is to handle a case where NULLs creep in there, which we are not sure is indemic to the system, or legacy. It would be nice to live fix these. | 287 | // TODO: this is to handle a case where NULLs creep in there, which we are not sure is endemic to the system, or legacy. It would be nice to live fix these. |
288 | if (reader["creatorID"] == null) | 288 | if (reader["creatorID"] == null) |
289 | { | 289 | { |
290 | item.CreatorId = UUID.Zero.ToString(); | 290 | item.CreatorId = UUID.Zero.ToString(); |
diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index af88c4a..01daeb1 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs | |||
@@ -73,7 +73,7 @@ namespace OpenSim.Framework | |||
73 | 73 | ||
74 | public delegate void LinkObjects(IClientAPI remoteClient, uint parent, List<uint> children); | 74 | public delegate void LinkObjects(IClientAPI remoteClient, uint parent, List<uint> children); |
75 | 75 | ||
76 | public delegate void DelinkObjects(List<uint> primIds); | 76 | public delegate void DelinkObjects(List<uint> primIds, IClientAPI client); |
77 | 77 | ||
78 | public delegate void RequestMapBlocks(IClientAPI remoteClient, int minX, int minY, int maxX, int maxY, uint flag); | 78 | public delegate void RequestMapBlocks(IClientAPI remoteClient, int minX, int minY, int maxX, int maxY, uint flag); |
79 | 79 | ||
diff --git a/OpenSim/Framework/PrimitiveBaseShape.cs b/OpenSim/Framework/PrimitiveBaseShape.cs index 1208b97..4d1de22 100644 --- a/OpenSim/Framework/PrimitiveBaseShape.cs +++ b/OpenSim/Framework/PrimitiveBaseShape.cs | |||
@@ -236,7 +236,7 @@ namespace OpenSim.Framework | |||
236 | catch { } | 236 | catch { } |
237 | 237 | ||
238 | m_log.Warn("[SHAPE]: Failed to decode texture, length=" + ((m_textureEntry != null) ? m_textureEntry.Length : 0)); | 238 | m_log.Warn("[SHAPE]: Failed to decode texture, length=" + ((m_textureEntry != null) ? m_textureEntry.Length : 0)); |
239 | return new Primitive.TextureEntry(null); | 239 | return new Primitive.TextureEntry(UUID.Zero); |
240 | } | 240 | } |
241 | 241 | ||
242 | set { m_textureEntry = value.GetBytes(); } | 242 | set { m_textureEntry = value.GetBytes(); } |
diff --git a/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs b/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs index 4543fd5..b0cf34d 100644 --- a/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs +++ b/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs | |||
@@ -81,7 +81,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
81 | } | 81 | } |
82 | catch (Exception e) | 82 | catch (Exception e) |
83 | { | 83 | { |
84 | m_log.DebugFormat("[FORMS]: exception occured on sending request {0}", e.Message); | 84 | m_log.DebugFormat("[FORMS]: exception occured on sending request to {0}: {1}", requestUrl, e.Message); |
85 | } | 85 | } |
86 | finally | 86 | finally |
87 | { | 87 | { |
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index d7120a5..1f3582c 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | |||
@@ -6151,7 +6151,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
6151 | DelinkObjects handlerDelinkObjects = OnDelinkObjects; | 6151 | DelinkObjects handlerDelinkObjects = OnDelinkObjects; |
6152 | if (handlerDelinkObjects != null) | 6152 | if (handlerDelinkObjects != null) |
6153 | { | 6153 | { |
6154 | handlerDelinkObjects(prims); | 6154 | handlerDelinkObjects(prims, this); |
6155 | } | 6155 | } |
6156 | 6156 | ||
6157 | return true; | 6157 | return true; |
@@ -11820,4 +11820,4 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
11820 | OutPacket(dialog, ThrottleOutPacketType.Task); | 11820 | OutPacket(dialog, ThrottleOutPacketType.Task); |
11821 | } | 11821 | } |
11822 | } | 11822 | } |
11823 | } \ No newline at end of file | 11823 | } |
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs index 312db38..23d5b3c 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs | |||
@@ -149,7 +149,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
149 | 149 | ||
150 | if (m_FriendsService == null) | 150 | if (m_FriendsService == null) |
151 | { | 151 | { |
152 | m_log.Error("[FRIENDS]: No Connector defined in section Friends, or filed to load, cannot continue"); | 152 | m_log.Error("[FRIENDS]: No Connector defined in section Friends, or failed to load, cannot continue"); |
153 | throw new Exception("Connector load error"); | 153 | throw new Exception("Connector load error"); |
154 | } | 154 | } |
155 | 155 | ||
diff --git a/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml b/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml index aaa318c..0a5ff3f 100644 --- a/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml +++ b/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml | |||
@@ -45,6 +45,7 @@ | |||
45 | <RegionModule id="HGAssetBroker" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset.HGAssetBroker" /> | 45 | <RegionModule id="HGAssetBroker" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset.HGAssetBroker" /> |
46 | <RegionModule id="LocalInventoryServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory.LocalInventoryServicesConnector" /> | 46 | <RegionModule id="LocalInventoryServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory.LocalInventoryServicesConnector" /> |
47 | <RegionModule id="RemoteInventoryServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory.RemoteInventoryServicesConnector" /> | 47 | <RegionModule id="RemoteInventoryServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory.RemoteInventoryServicesConnector" /> |
48 | <RegionModule id="RemoteXInventoryServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory.RemoteXInventoryServicesConnector" /> | ||
48 | <RegionModule id="HGInventoryBroker" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory.HGInventoryBroker" /> | 49 | <RegionModule id="HGInventoryBroker" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory.HGInventoryBroker" /> |
49 | <RegionModule id="LocalNeighbourServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Neighbour.LocalNeighbourServicesConnector" /> | 50 | <RegionModule id="LocalNeighbourServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Neighbour.LocalNeighbourServicesConnector" /> |
50 | <RegionModule id="RemoteNeighbourServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Neighbour.RemoteNeighbourServicesConnector" /> | 51 | <RegionModule id="RemoteNeighbourServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Neighbour.RemoteNeighbourServicesConnector" /> |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker2.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker2.cs new file mode 100644 index 0000000..3509161 --- /dev/null +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker2.cs | |||
@@ -0,0 +1,618 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using log4net; | ||
29 | using Nini.Config; | ||
30 | using System; | ||
31 | using System.Collections.Generic; | ||
32 | using System.Reflection; | ||
33 | using OpenSim.Framework; | ||
34 | |||
35 | using OpenSim.Server.Base; | ||
36 | using OpenSim.Region.Framework.Interfaces; | ||
37 | using OpenSim.Region.Framework.Scenes; | ||
38 | using OpenSim.Services.Interfaces; | ||
39 | using OpenSim.Services.Connectors; | ||
40 | using OpenMetaverse; | ||
41 | |||
42 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | ||
43 | { | ||
44 | public class HGInventoryBroker2 : INonSharedRegionModule, IInventoryService | ||
45 | { | ||
46 | private static readonly ILog m_log = | ||
47 | LogManager.GetLogger( | ||
48 | MethodBase.GetCurrentMethod().DeclaringType); | ||
49 | |||
50 | private static bool m_Initialized = false; | ||
51 | private static bool m_Enabled = false; | ||
52 | |||
53 | private static IInventoryService m_LocalGridInventoryService; | ||
54 | private static ISessionAuthInventoryService m_HGService; // obsolete | ||
55 | private Dictionary<string, IInventoryService> m_connectors = new Dictionary<string, IInventoryService>(); | ||
56 | |||
57 | // A cache of userIDs --> ServiceURLs, for HGBroker only | ||
58 | protected Dictionary<UUID, string> m_InventoryURLs; | ||
59 | |||
60 | private Scene m_Scene; | ||
61 | private List<Scene> m_Scenes = new List<Scene>(); | ||
62 | |||
63 | private IUserAccountService m_UserAccountService; | ||
64 | |||
65 | public Type ReplaceableInterface | ||
66 | { | ||
67 | get { return null; } | ||
68 | } | ||
69 | |||
70 | public string Name | ||
71 | { | ||
72 | get { return "HGInventoryBroker2"; } | ||
73 | } | ||
74 | |||
75 | public void Initialise(IConfigSource source) | ||
76 | { | ||
77 | if (!m_Initialized) | ||
78 | { | ||
79 | IConfig moduleConfig = source.Configs["Modules"]; | ||
80 | if (moduleConfig != null) | ||
81 | { | ||
82 | string name = moduleConfig.GetString("InventoryServices", ""); | ||
83 | if (name == Name) | ||
84 | { | ||
85 | IConfig inventoryConfig = source.Configs["InventoryService"]; | ||
86 | if (inventoryConfig == null) | ||
87 | { | ||
88 | m_log.Error("[HG INVENTORY CONNECTOR]: InventoryService missing from OpenSim.ini"); | ||
89 | return; | ||
90 | } | ||
91 | |||
92 | string localDll = inventoryConfig.GetString("LocalGridInventoryService", | ||
93 | String.Empty); | ||
94 | string HGDll = inventoryConfig.GetString("HypergridInventoryService", | ||
95 | String.Empty); | ||
96 | |||
97 | if (localDll == String.Empty) | ||
98 | { | ||
99 | m_log.Error("[HG INVENTORY CONNECTOR]: No LocalGridInventoryService named in section InventoryService"); | ||
100 | //return; | ||
101 | throw new Exception("Unable to proceed. Please make sure your ini files in config-include are updated according to .example's"); | ||
102 | } | ||
103 | |||
104 | if (HGDll == String.Empty) | ||
105 | { | ||
106 | m_log.Error("[HG INVENTORY CONNECTOR]: No HypergridInventoryService named in section InventoryService"); | ||
107 | //return; | ||
108 | throw new Exception("Unable to proceed. Please make sure your ini files in config-include are updated according to .example's"); | ||
109 | } | ||
110 | |||
111 | Object[] args = new Object[] { source }; | ||
112 | m_LocalGridInventoryService = | ||
113 | ServerUtils.LoadPlugin<IInventoryService>(localDll, | ||
114 | args); | ||
115 | |||
116 | m_HGService = | ||
117 | ServerUtils.LoadPlugin<ISessionAuthInventoryService>(HGDll, | ||
118 | args); | ||
119 | |||
120 | if (m_LocalGridInventoryService == null) | ||
121 | { | ||
122 | m_log.Error("[HG INVENTORY CONNECTOR]: Can't load local inventory service"); | ||
123 | return; | ||
124 | } | ||
125 | if (m_HGService == null) | ||
126 | { | ||
127 | m_log.Error("[HG INVENTORY CONNECTOR]: Can't load hypergrid inventory service"); | ||
128 | return; | ||
129 | } | ||
130 | |||
131 | m_Enabled = true; | ||
132 | m_log.Info("[HG INVENTORY CONNECTOR]: HG inventory broker enabled"); | ||
133 | } | ||
134 | } | ||
135 | m_Initialized = true; | ||
136 | } | ||
137 | } | ||
138 | |||
139 | public void PostInitialise() | ||
140 | { | ||
141 | } | ||
142 | |||
143 | public void Close() | ||
144 | { | ||
145 | } | ||
146 | |||
147 | public void AddRegion(Scene scene) | ||
148 | { | ||
149 | if (!m_Enabled) | ||
150 | return; | ||
151 | |||
152 | m_Scene = scene; | ||
153 | m_Scenes.Add(scene); | ||
154 | m_UserAccountService = m_Scene.UserAccountService; | ||
155 | |||
156 | scene.RegisterModuleInterface<IInventoryService>(this); | ||
157 | |||
158 | scene.EventManager.OnMakeRootAgent += OnMakeRootAgent; | ||
159 | scene.EventManager.OnClientClosed += OnClientClosed; | ||
160 | |||
161 | } | ||
162 | |||
163 | public void RemoveRegion(Scene scene) | ||
164 | { | ||
165 | if (!m_Enabled) | ||
166 | return; | ||
167 | |||
168 | m_Scenes.Remove(scene); | ||
169 | } | ||
170 | |||
171 | public void RegionLoaded(Scene scene) | ||
172 | { | ||
173 | if (!m_Enabled) | ||
174 | return; | ||
175 | |||
176 | m_log.InfoFormat("[HG INVENTORY CONNECTOR]: Enabled HG inventory for region {0}", scene.RegionInfo.RegionName); | ||
177 | |||
178 | } | ||
179 | |||
180 | #region Cache | ||
181 | |||
182 | void OnMakeRootAgent(ScenePresence presence) | ||
183 | { | ||
184 | if (!m_InventoryURLs.ContainsKey(presence.UUID)) | ||
185 | CacheInventoryServiceURL(presence.Scene, presence.UUID); | ||
186 | } | ||
187 | |||
188 | void OnClientClosed(UUID clientID, Scene scene) | ||
189 | { | ||
190 | if (m_InventoryURLs.ContainsKey(clientID)) // if it's in cache | ||
191 | { | ||
192 | ScenePresence sp = null; | ||
193 | foreach (Scene s in m_Scenes) | ||
194 | { | ||
195 | s.TryGetScenePresence(clientID, out sp); | ||
196 | if ((sp != null) && !sp.IsChildAgent && (s != scene)) | ||
197 | { | ||
198 | m_log.DebugFormat("[INVENTORY CACHE]: OnClientClosed in {0}, but user {1} still in sim. Keeping inventoryURL in cache", | ||
199 | scene.RegionInfo.RegionName, clientID); | ||
200 | return; | ||
201 | } | ||
202 | } | ||
203 | |||
204 | m_log.DebugFormat( | ||
205 | "[INVENTORY CACHE]: OnClientClosed in {0}, user {1} out of sim. Dropping inventory URL", | ||
206 | scene.RegionInfo.RegionName, clientID); | ||
207 | DropInventoryServiceURL(clientID); | ||
208 | } | ||
209 | } | ||
210 | |||
211 | /// <summary> | ||
212 | /// Gets the user's inventory URL from its serviceURLs, if the user is foreign, | ||
213 | /// and sticks it in the cache | ||
214 | /// </summary> | ||
215 | /// <param name="userID"></param> | ||
216 | private void CacheInventoryServiceURL(Scene scene, UUID userID) | ||
217 | { | ||
218 | if (scene.UserAccountService.GetUserAccount(scene.RegionInfo.ScopeID, userID) == null) | ||
219 | { | ||
220 | // The user does not have a local account; let's cache its service URL | ||
221 | string inventoryURL = string.Empty; | ||
222 | ScenePresence sp = null; | ||
223 | scene.TryGetScenePresence(userID, out sp); | ||
224 | if (sp != null) | ||
225 | { | ||
226 | AgentCircuitData aCircuit = scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode); | ||
227 | if (aCircuit.ServiceURLs.ContainsKey("InventoryServerURI")) | ||
228 | { | ||
229 | inventoryURL = aCircuit.ServiceURLs["InventoryServerURI"].ToString(); | ||
230 | if (inventoryURL != null && inventoryURL != string.Empty) | ||
231 | { | ||
232 | inventoryURL = inventoryURL.Trim(new char[] { '/' }); | ||
233 | m_InventoryURLs.Add(userID, inventoryURL); | ||
234 | } | ||
235 | } | ||
236 | } | ||
237 | } | ||
238 | } | ||
239 | |||
240 | private void DropInventoryServiceURL(UUID userID) | ||
241 | { | ||
242 | lock (m_InventoryURLs) | ||
243 | if (m_InventoryURLs.ContainsKey(userID)) | ||
244 | m_InventoryURLs.Remove(userID); | ||
245 | } | ||
246 | |||
247 | public string GetInventoryServiceURL(UUID userID) | ||
248 | { | ||
249 | if (m_InventoryURLs.ContainsKey(userID)) | ||
250 | return m_InventoryURLs[userID]; | ||
251 | |||
252 | return null; | ||
253 | } | ||
254 | #endregion | ||
255 | |||
256 | #region IInventoryService | ||
257 | |||
258 | public bool CreateUserInventory(UUID userID) | ||
259 | { | ||
260 | return m_LocalGridInventoryService.CreateUserInventory(userID); | ||
261 | } | ||
262 | |||
263 | public List<InventoryFolderBase> GetInventorySkeleton(UUID userId) | ||
264 | { | ||
265 | return m_LocalGridInventoryService.GetInventorySkeleton(userId); | ||
266 | } | ||
267 | |||
268 | public InventoryCollection GetUserInventory(UUID userID) | ||
269 | { | ||
270 | return null; | ||
271 | } | ||
272 | |||
273 | public void GetUserInventory(UUID userID, InventoryReceiptCallback callback) | ||
274 | { | ||
275 | } | ||
276 | |||
277 | public InventoryFolderBase GetRootFolder(UUID userID) | ||
278 | { | ||
279 | m_log.DebugFormat("[HGInventory]: GetRootFolder for {0}", userID); | ||
280 | |||
281 | string invURL = GetInventoryServiceURL(userID); | ||
282 | |||
283 | if (invURL == null) // not there, forward to local inventory connector to resolve | ||
284 | return m_LocalGridInventoryService.GetRootFolder(userID); | ||
285 | |||
286 | IInventoryService connector = GetConnector(invURL); | ||
287 | |||
288 | return connector.GetRootFolder(userID); | ||
289 | } | ||
290 | |||
291 | public InventoryFolderBase GetFolderForType(UUID userID, AssetType type) | ||
292 | { | ||
293 | m_log.DebugFormat("[HGInventory]: GetFolderForType {0} type {1}", userID, type); | ||
294 | |||
295 | string invURL = GetInventoryServiceURL(userID); | ||
296 | |||
297 | if (invURL == null) // not there, forward to local inventory connector to resolve | ||
298 | return m_LocalGridInventoryService.GetFolderForType(userID, type); | ||
299 | |||
300 | IInventoryService connector = GetConnector(invURL); | ||
301 | |||
302 | return connector.GetFolderForType(userID, type); | ||
303 | } | ||
304 | |||
305 | public InventoryCollection GetFolderContent(UUID userID, UUID folderID) | ||
306 | { | ||
307 | m_log.Debug("[HGInventory]: GetFolderContent " + folderID); | ||
308 | |||
309 | string invURL = GetInventoryServiceURL(userID); | ||
310 | |||
311 | if (invURL == null) // not there, forward to local inventory connector to resolve | ||
312 | return m_LocalGridInventoryService.GetFolderContent(userID, folderID); | ||
313 | |||
314 | IInventoryService connector = GetConnector(invURL); | ||
315 | |||
316 | return connector.GetFolderContent(userID, folderID); | ||
317 | |||
318 | } | ||
319 | |||
320 | public List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID) | ||
321 | { | ||
322 | m_log.Debug("[HGInventory]: GetFolderItems " + folderID); | ||
323 | |||
324 | string invURL = GetInventoryServiceURL(userID); | ||
325 | |||
326 | if (invURL == null) // not there, forward to local inventory connector to resolve | ||
327 | return m_LocalGridInventoryService.GetFolderItems(userID, folderID); | ||
328 | |||
329 | IInventoryService connector = GetConnector(invURL); | ||
330 | |||
331 | return connector.GetFolderItems(userID, folderID); | ||
332 | |||
333 | } | ||
334 | |||
335 | public bool AddFolder(InventoryFolderBase folder) | ||
336 | { | ||
337 | if (folder == null) | ||
338 | return false; | ||
339 | |||
340 | m_log.Debug("[HGInventory]: AddFolder " + folder.ID); | ||
341 | |||
342 | string invURL = GetInventoryServiceURL(folder.Owner); | ||
343 | |||
344 | if (invURL == null) // not there, forward to local inventory connector to resolve | ||
345 | return m_LocalGridInventoryService.AddFolder(folder); | ||
346 | |||
347 | IInventoryService connector = GetConnector(invURL); | ||
348 | |||
349 | return connector.AddFolder(folder); | ||
350 | } | ||
351 | |||
352 | public bool UpdateFolder(InventoryFolderBase folder) | ||
353 | { | ||
354 | if (folder == null) | ||
355 | return false; | ||
356 | |||
357 | m_log.Debug("[HGInventory]: UpdateFolder " + folder.ID); | ||
358 | |||
359 | string invURL = GetInventoryServiceURL(folder.Owner); | ||
360 | |||
361 | if (invURL == null) // not there, forward to local inventory connector to resolve | ||
362 | return m_LocalGridInventoryService.UpdateFolder(folder); | ||
363 | |||
364 | IInventoryService connector = GetConnector(invURL); | ||
365 | |||
366 | return connector.UpdateFolder(folder); | ||
367 | } | ||
368 | |||
369 | public bool DeleteFolders(UUID ownerID, List<UUID> folderIDs) | ||
370 | { | ||
371 | if (folderIDs == null) | ||
372 | return false; | ||
373 | if (folderIDs.Count == 0) | ||
374 | return false; | ||
375 | |||
376 | m_log.Debug("[HGInventory]: DeleteFolders for " + ownerID); | ||
377 | |||
378 | string invURL = GetInventoryServiceURL(ownerID); | ||
379 | |||
380 | if (invURL == null) // not there, forward to local inventory connector to resolve | ||
381 | return m_LocalGridInventoryService.DeleteFolders(ownerID, folderIDs); | ||
382 | |||
383 | IInventoryService connector = GetConnector(invURL); | ||
384 | |||
385 | return connector.DeleteFolders(ownerID, folderIDs); | ||
386 | } | ||
387 | |||
388 | public bool MoveFolder(InventoryFolderBase folder) | ||
389 | { | ||
390 | if (folder == null) | ||
391 | return false; | ||
392 | |||
393 | m_log.Debug("[HGInventory]: MoveFolder for " + folder.Owner); | ||
394 | |||
395 | string invURL = GetInventoryServiceURL(folder.Owner); | ||
396 | |||
397 | if (invURL == null) // not there, forward to local inventory connector to resolve | ||
398 | return m_LocalGridInventoryService.MoveFolder(folder); | ||
399 | |||
400 | IInventoryService connector = GetConnector(invURL); | ||
401 | |||
402 | return connector.MoveFolder(folder); | ||
403 | } | ||
404 | |||
405 | public bool PurgeFolder(InventoryFolderBase folder) | ||
406 | { | ||
407 | if (folder == null) | ||
408 | return false; | ||
409 | |||
410 | m_log.Debug("[HGInventory]: PurgeFolder for " + folder.Owner); | ||
411 | |||
412 | string invURL = GetInventoryServiceURL(folder.Owner); | ||
413 | |||
414 | if (invURL == null) // not there, forward to local inventory connector to resolve | ||
415 | return m_LocalGridInventoryService.PurgeFolder(folder); | ||
416 | |||
417 | IInventoryService connector = GetConnector(invURL); | ||
418 | |||
419 | return connector.PurgeFolder(folder); | ||
420 | } | ||
421 | |||
422 | public bool AddItem(InventoryItemBase item) | ||
423 | { | ||
424 | if (item == null) | ||
425 | return false; | ||
426 | |||
427 | m_log.Debug("[HGInventory]: AddItem " + item.ID); | ||
428 | |||
429 | string invURL = GetInventoryServiceURL(item.Owner); | ||
430 | |||
431 | if (invURL == null) // not there, forward to local inventory connector to resolve | ||
432 | return m_LocalGridInventoryService.AddItem(item); | ||
433 | |||
434 | IInventoryService connector = GetConnector(invURL); | ||
435 | |||
436 | return connector.AddItem(item); | ||
437 | } | ||
438 | |||
439 | public bool UpdateItem(InventoryItemBase item) | ||
440 | { | ||
441 | if (item == null) | ||
442 | return false; | ||
443 | |||
444 | m_log.Debug("[HGInventory]: UpdateItem " + item.ID); | ||
445 | |||
446 | string invURL = GetInventoryServiceURL(item.Owner); | ||
447 | |||
448 | if (invURL == null) // not there, forward to local inventory connector to resolve | ||
449 | return m_LocalGridInventoryService.UpdateItem(item); | ||
450 | |||
451 | IInventoryService connector = GetConnector(invURL); | ||
452 | |||
453 | return connector.UpdateItem(item); | ||
454 | } | ||
455 | |||
456 | public bool MoveItems(UUID ownerID, List<InventoryItemBase> items) | ||
457 | { | ||
458 | if (items == null) | ||
459 | return false; | ||
460 | if (items.Count == 0) | ||
461 | return true; | ||
462 | |||
463 | m_log.Debug("[HGInventory]: MoveItems for " + ownerID); | ||
464 | |||
465 | string invURL = GetInventoryServiceURL(ownerID); | ||
466 | |||
467 | if (invURL == null) // not there, forward to local inventory connector to resolve | ||
468 | return m_LocalGridInventoryService.MoveItems(ownerID, items); | ||
469 | |||
470 | IInventoryService connector = GetConnector(invURL); | ||
471 | |||
472 | return connector.MoveItems(ownerID, items); | ||
473 | } | ||
474 | |||
475 | public bool DeleteItems(UUID ownerID, List<UUID> itemIDs) | ||
476 | { | ||
477 | m_log.DebugFormat("[HG INVENTORY CONNECTOR]: Delete {0} items for user {1}", itemIDs.Count, ownerID); | ||
478 | |||
479 | if (itemIDs == null) | ||
480 | return false; | ||
481 | if (itemIDs.Count == 0) | ||
482 | return true; | ||
483 | |||
484 | m_log.Debug("[HGInventory]: DeleteItems for " + ownerID); | ||
485 | |||
486 | string invURL = GetInventoryServiceURL(ownerID); | ||
487 | |||
488 | if (invURL == null) // not there, forward to local inventory connector to resolve | ||
489 | return m_LocalGridInventoryService.DeleteItems(ownerID, itemIDs); | ||
490 | |||
491 | IInventoryService connector = GetConnector(invURL); | ||
492 | |||
493 | return connector.DeleteItems(ownerID, itemIDs); | ||
494 | } | ||
495 | |||
496 | public InventoryItemBase GetItem(InventoryItemBase item) | ||
497 | { | ||
498 | if (item == null) | ||
499 | return null; | ||
500 | m_log.Debug("[HGInventory]: GetItem " + item.ID); | ||
501 | |||
502 | string invURL = GetInventoryServiceURL(item.Owner); | ||
503 | |||
504 | if (invURL == null) // not there, forward to local inventory connector to resolve | ||
505 | return m_LocalGridInventoryService.GetItem(item); | ||
506 | |||
507 | IInventoryService connector = GetConnector(invURL); | ||
508 | |||
509 | return connector.GetItem(item); | ||
510 | } | ||
511 | |||
512 | public InventoryFolderBase GetFolder(InventoryFolderBase folder) | ||
513 | { | ||
514 | if (folder == null) | ||
515 | return null; | ||
516 | |||
517 | m_log.Debug("[HGInventory]: GetFolder " + folder.ID); | ||
518 | |||
519 | string invURL = GetInventoryServiceURL(folder.Owner); | ||
520 | |||
521 | if (invURL == null) // not there, forward to local inventory connector to resolve | ||
522 | return m_LocalGridInventoryService.GetFolder(folder); | ||
523 | |||
524 | IInventoryService connector = GetConnector(invURL); | ||
525 | |||
526 | return connector.GetFolder(folder); | ||
527 | } | ||
528 | |||
529 | public bool HasInventoryForUser(UUID userID) | ||
530 | { | ||
531 | return false; | ||
532 | } | ||
533 | |||
534 | public List<InventoryItemBase> GetActiveGestures(UUID userId) | ||
535 | { | ||
536 | return new List<InventoryItemBase>(); | ||
537 | } | ||
538 | |||
539 | public int GetAssetPermissions(UUID userID, UUID assetID) | ||
540 | { | ||
541 | m_log.Debug("[HGInventory]: GetAssetPermissions " + assetID); | ||
542 | |||
543 | string invURL = GetInventoryServiceURL(userID); | ||
544 | |||
545 | if (invURL == null) // not there, forward to local inventory connector to resolve | ||
546 | return m_LocalGridInventoryService.GetAssetPermissions(userID, assetID); | ||
547 | |||
548 | IInventoryService connector = GetConnector(invURL); | ||
549 | |||
550 | return connector.GetAssetPermissions(userID, assetID); | ||
551 | } | ||
552 | |||
553 | #endregion | ||
554 | |||
555 | private IInventoryService GetConnector(string url) | ||
556 | { | ||
557 | IInventoryService connector = null; | ||
558 | lock (m_connectors) | ||
559 | { | ||
560 | if (m_connectors.ContainsKey(url)) | ||
561 | { | ||
562 | connector = m_connectors[url]; | ||
563 | } | ||
564 | else | ||
565 | { | ||
566 | // We're instantiating this class explicitly, but this won't | ||
567 | // work in general, because the remote grid may be running | ||
568 | // an inventory server that has a different protocol. | ||
569 | // Eventually we will want a piece of protocol asking | ||
570 | // the remote server about its kind. Definitely cool thing to do! | ||
571 | connector = new RemoteXInventoryServicesConnector(url); | ||
572 | m_connectors.Add(url, connector); | ||
573 | } | ||
574 | } | ||
575 | return connector; | ||
576 | } | ||
577 | |||
578 | |||
579 | private UUID GetSessionID(UUID userID) | ||
580 | { | ||
581 | ScenePresence sp = null; | ||
582 | if (m_Scene.TryGetScenePresence(userID, out sp)) | ||
583 | { | ||
584 | return sp.ControllingClient.SessionId; | ||
585 | } | ||
586 | |||
587 | m_log.DebugFormat("[HG INVENTORY CONNECTOR]: scene presence for {0} not found", userID); | ||
588 | return UUID.Zero; | ||
589 | } | ||
590 | |||
591 | private bool IsForeignUser(UUID userID, out string inventoryURL) | ||
592 | { | ||
593 | inventoryURL = string.Empty; | ||
594 | UserAccount account = null; | ||
595 | if (m_Scene.UserAccountService != null) | ||
596 | account = m_Scene.UserAccountService.GetUserAccount(m_Scene.RegionInfo.ScopeID, userID); | ||
597 | |||
598 | if (account == null) // foreign user | ||
599 | { | ||
600 | ScenePresence sp = null; | ||
601 | m_Scene.TryGetScenePresence(userID, out sp); | ||
602 | if (sp != null) | ||
603 | { | ||
604 | AgentCircuitData aCircuit = m_Scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode); | ||
605 | if (aCircuit.ServiceURLs.ContainsKey("InventoryServerURI")) | ||
606 | { | ||
607 | inventoryURL = aCircuit.ServiceURLs["InventoryServerURI"].ToString(); | ||
608 | inventoryURL = inventoryURL.Trim(new char[] { '/' }); | ||
609 | return true; | ||
610 | } | ||
611 | } | ||
612 | } | ||
613 | return false; | ||
614 | } | ||
615 | |||
616 | |||
617 | } | ||
618 | } | ||
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs index 5e06580..9c6e1cd 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs | |||
@@ -51,6 +51,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
51 | // The cache proper | 51 | // The cache proper |
52 | protected Dictionary<UUID, Dictionary<AssetType, InventoryFolderBase>> m_InventoryCache; | 52 | protected Dictionary<UUID, Dictionary<AssetType, InventoryFolderBase>> m_InventoryCache; |
53 | 53 | ||
54 | // A cache of userIDs --> ServiceURLs, for HGBroker only | ||
55 | protected Dictionary<UUID, string> m_InventoryURLs; | ||
56 | |||
54 | public virtual void Init(IConfigSource source, BaseInventoryConnector connector) | 57 | public virtual void Init(IConfigSource source, BaseInventoryConnector connector) |
55 | { | 58 | { |
56 | m_Scenes = new List<Scene>(); | 59 | m_Scenes = new List<Scene>(); |
@@ -89,8 +92,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
89 | 92 | ||
90 | // If not, go get them and place them in the cache | 93 | // If not, go get them and place them in the cache |
91 | Dictionary<AssetType, InventoryFolderBase> folders = CacheSystemFolders(presence.UUID); | 94 | Dictionary<AssetType, InventoryFolderBase> folders = CacheSystemFolders(presence.UUID); |
95 | CacheInventoryServiceURL(presence.Scene, presence.UUID); | ||
96 | |||
92 | m_log.DebugFormat("[INVENTORY CACHE]: OnMakeRootAgent in {0}, fetched system folders for {1} {2}: count {3}", | 97 | m_log.DebugFormat("[INVENTORY CACHE]: OnMakeRootAgent in {0}, fetched system folders for {1} {2}: count {3}", |
93 | presence.Scene.RegionInfo.RegionName, presence.Firstname, presence.Lastname, folders.Count); | 98 | presence.Scene.RegionInfo.RegionName, presence.Firstname, presence.Lastname, folders.Count); |
99 | |||
94 | } | 100 | } |
95 | 101 | ||
96 | void OnClientClosed(UUID clientID, Scene scene) | 102 | void OnClientClosed(UUID clientID, Scene scene) |
@@ -113,6 +119,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
113 | "[INVENTORY CACHE]: OnClientClosed in {0}, user {1} out of sim. Dropping system folders", | 119 | "[INVENTORY CACHE]: OnClientClosed in {0}, user {1} out of sim. Dropping system folders", |
114 | scene.RegionInfo.RegionName, clientID); | 120 | scene.RegionInfo.RegionName, clientID); |
115 | DropCachedSystemFolders(clientID); | 121 | DropCachedSystemFolders(clientID); |
122 | DropInventoryServiceURL(clientID); | ||
116 | } | 123 | } |
117 | } | 124 | } |
118 | 125 | ||
@@ -174,5 +181,49 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
174 | 181 | ||
175 | return null; | 182 | return null; |
176 | } | 183 | } |
184 | |||
185 | /// <summary> | ||
186 | /// Gets the user's inventory URL from its serviceURLs, if the user is foreign, | ||
187 | /// and sticks it in the cache | ||
188 | /// </summary> | ||
189 | /// <param name="userID"></param> | ||
190 | private void CacheInventoryServiceURL(Scene scene, UUID userID) | ||
191 | { | ||
192 | if (scene.UserAccountService.GetUserAccount(scene.RegionInfo.ScopeID, userID) == null) | ||
193 | { | ||
194 | // The user does not have a local account; let's cache its service URL | ||
195 | string inventoryURL = string.Empty; | ||
196 | ScenePresence sp = null; | ||
197 | scene.TryGetScenePresence(userID, out sp); | ||
198 | if (sp != null) | ||
199 | { | ||
200 | AgentCircuitData aCircuit = scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode); | ||
201 | if (aCircuit.ServiceURLs.ContainsKey("InventoryServerURI")) | ||
202 | { | ||
203 | inventoryURL = aCircuit.ServiceURLs["InventoryServerURI"].ToString(); | ||
204 | if (inventoryURL != null && inventoryURL != string.Empty) | ||
205 | { | ||
206 | inventoryURL = inventoryURL.Trim(new char[] { '/' }); | ||
207 | m_InventoryURLs.Add(userID, inventoryURL); | ||
208 | } | ||
209 | } | ||
210 | } | ||
211 | } | ||
212 | } | ||
213 | |||
214 | private void DropInventoryServiceURL(UUID userID) | ||
215 | { | ||
216 | lock (m_InventoryURLs) | ||
217 | if (m_InventoryURLs.ContainsKey(userID)) | ||
218 | m_InventoryURLs.Remove(userID); | ||
219 | } | ||
220 | |||
221 | public string GetInventoryServiceURL(UUID userID) | ||
222 | { | ||
223 | if (m_InventoryURLs.ContainsKey(userID)) | ||
224 | return m_InventoryURLs[userID]; | ||
225 | |||
226 | return null; | ||
227 | } | ||
177 | } | 228 | } |
178 | } | 229 | } |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs new file mode 100644 index 0000000..ac9e792 --- /dev/null +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs | |||
@@ -0,0 +1,305 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using log4net; | ||
29 | using System; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Reflection; | ||
32 | using Nini.Config; | ||
33 | using OpenSim.Framework; | ||
34 | using OpenSim.Framework.Statistics; | ||
35 | |||
36 | using OpenSim.Services.Connectors; | ||
37 | using OpenSim.Region.Framework.Interfaces; | ||
38 | using OpenSim.Region.Framework.Scenes; | ||
39 | using OpenSim.Services.Interfaces; | ||
40 | using OpenMetaverse; | ||
41 | |||
42 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | ||
43 | { | ||
44 | public class RemoteXInventoryServicesConnector : ISharedRegionModule, IInventoryService | ||
45 | { | ||
46 | private static readonly ILog m_log = | ||
47 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
48 | |||
49 | private bool m_Enabled = false; | ||
50 | private bool m_Initialized = false; | ||
51 | private Scene m_Scene; | ||
52 | private XInventoryServicesConnector m_RemoteConnector; | ||
53 | |||
54 | public Type ReplaceableInterface | ||
55 | { | ||
56 | get { return null; } | ||
57 | } | ||
58 | |||
59 | public string Name | ||
60 | { | ||
61 | get { return "RemoteXInventoryServicesConnector"; } | ||
62 | } | ||
63 | |||
64 | public RemoteXInventoryServicesConnector() | ||
65 | { | ||
66 | } | ||
67 | |||
68 | public RemoteXInventoryServicesConnector(string url) | ||
69 | { | ||
70 | m_RemoteConnector = new XInventoryServicesConnector(url); | ||
71 | } | ||
72 | |||
73 | public RemoteXInventoryServicesConnector(IConfigSource source) | ||
74 | { | ||
75 | Init(source); | ||
76 | } | ||
77 | |||
78 | protected void Init(IConfigSource source) | ||
79 | { | ||
80 | m_RemoteConnector = new XInventoryServicesConnector(source); | ||
81 | } | ||
82 | |||
83 | |||
84 | #region ISharedRegionModule | ||
85 | |||
86 | public void Initialise(IConfigSource source) | ||
87 | { | ||
88 | IConfig moduleConfig = source.Configs["Modules"]; | ||
89 | if (moduleConfig != null) | ||
90 | { | ||
91 | string name = moduleConfig.GetString("InventoryServices", ""); | ||
92 | if (name == Name) | ||
93 | { | ||
94 | Init(source); | ||
95 | m_Enabled = true; | ||
96 | |||
97 | m_log.Info("[XINVENTORY CONNECTOR]: Remote XInventory enabled"); | ||
98 | } | ||
99 | } | ||
100 | } | ||
101 | |||
102 | public void PostInitialise() | ||
103 | { | ||
104 | } | ||
105 | |||
106 | public void Close() | ||
107 | { | ||
108 | } | ||
109 | |||
110 | public void AddRegion(Scene scene) | ||
111 | { | ||
112 | m_Scene = scene; | ||
113 | //m_log.Debug("[XXXX] Adding scene " + m_Scene.RegionInfo.RegionName); | ||
114 | |||
115 | if (!m_Enabled) | ||
116 | return; | ||
117 | |||
118 | if (!m_Initialized) | ||
119 | { | ||
120 | m_Initialized = true; | ||
121 | } | ||
122 | |||
123 | scene.RegisterModuleInterface<IInventoryService>(this); | ||
124 | } | ||
125 | |||
126 | public void RemoveRegion(Scene scene) | ||
127 | { | ||
128 | if (!m_Enabled) | ||
129 | return; | ||
130 | |||
131 | } | ||
132 | |||
133 | public void RegionLoaded(Scene scene) | ||
134 | { | ||
135 | if (!m_Enabled) | ||
136 | return; | ||
137 | |||
138 | m_log.InfoFormat("[XINVENTORY CONNECTOR]: Enabled remote XInventory for region {0}", scene.RegionInfo.RegionName); | ||
139 | |||
140 | } | ||
141 | |||
142 | #endregion ISharedRegionModule | ||
143 | |||
144 | #region IInventoryService | ||
145 | |||
146 | public bool CreateUserInventory(UUID user) | ||
147 | { | ||
148 | return false; | ||
149 | } | ||
150 | |||
151 | public List<InventoryFolderBase> GetInventorySkeleton(UUID userId) | ||
152 | { | ||
153 | return new List<InventoryFolderBase>(); | ||
154 | } | ||
155 | |||
156 | public InventoryCollection GetUserInventory(UUID userID) | ||
157 | { | ||
158 | return null; | ||
159 | } | ||
160 | |||
161 | public void GetUserInventory(UUID userID, InventoryReceiptCallback callback) | ||
162 | { | ||
163 | } | ||
164 | |||
165 | public InventoryFolderBase GetRootFolder(UUID userID) | ||
166 | { | ||
167 | return m_RemoteConnector.GetRootFolder(userID); | ||
168 | } | ||
169 | |||
170 | public InventoryFolderBase GetFolderForType(UUID userID, AssetType type) | ||
171 | { | ||
172 | return m_RemoteConnector.GetFolderForType(userID, type); | ||
173 | } | ||
174 | |||
175 | public Dictionary<AssetType, InventoryFolderBase> GetSystemFolders(UUID userID) | ||
176 | { | ||
177 | return m_RemoteConnector.GetSystemFolders(userID); | ||
178 | } | ||
179 | |||
180 | public InventoryCollection GetFolderContent(UUID userID, UUID folderID) | ||
181 | { | ||
182 | return m_RemoteConnector.GetFolderContent(userID, folderID); | ||
183 | } | ||
184 | |||
185 | public List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID) | ||
186 | { | ||
187 | return m_RemoteConnector.GetFolderItems(userID, folderID); | ||
188 | } | ||
189 | |||
190 | public bool AddFolder(InventoryFolderBase folder) | ||
191 | { | ||
192 | if (folder == null) | ||
193 | return false; | ||
194 | |||
195 | return m_RemoteConnector.AddFolder(folder); | ||
196 | } | ||
197 | |||
198 | public bool UpdateFolder(InventoryFolderBase folder) | ||
199 | { | ||
200 | if (folder == null) | ||
201 | return false; | ||
202 | |||
203 | return m_RemoteConnector.UpdateFolder(folder); | ||
204 | } | ||
205 | |||
206 | public bool MoveFolder(InventoryFolderBase folder) | ||
207 | { | ||
208 | if (folder == null) | ||
209 | return false; | ||
210 | |||
211 | return m_RemoteConnector.MoveFolder(folder); | ||
212 | } | ||
213 | |||
214 | public bool DeleteFolders(UUID ownerID, List<UUID> folderIDs) | ||
215 | { | ||
216 | if (folderIDs == null) | ||
217 | return false; | ||
218 | if (folderIDs.Count == 0) | ||
219 | return false; | ||
220 | |||
221 | return m_RemoteConnector.DeleteFolders(ownerID, folderIDs); | ||
222 | } | ||
223 | |||
224 | |||
225 | public bool PurgeFolder(InventoryFolderBase folder) | ||
226 | { | ||
227 | if (folder == null) | ||
228 | return false; | ||
229 | |||
230 | return m_RemoteConnector.PurgeFolder(folder); | ||
231 | } | ||
232 | |||
233 | public bool AddItem(InventoryItemBase item) | ||
234 | { | ||
235 | if (item == null) | ||
236 | return false; | ||
237 | |||
238 | return m_RemoteConnector.AddItem(item); | ||
239 | } | ||
240 | |||
241 | public bool UpdateItem(InventoryItemBase item) | ||
242 | { | ||
243 | if (item == null) | ||
244 | return false; | ||
245 | |||
246 | return m_RemoteConnector.UpdateItem(item); | ||
247 | } | ||
248 | |||
249 | public bool MoveItems(UUID ownerID, List<InventoryItemBase> items) | ||
250 | { | ||
251 | if (items == null) | ||
252 | return false; | ||
253 | |||
254 | return m_RemoteConnector.MoveItems(ownerID, items); | ||
255 | } | ||
256 | |||
257 | |||
258 | public bool DeleteItems(UUID ownerID, List<UUID> itemIDs) | ||
259 | { | ||
260 | if (itemIDs == null) | ||
261 | return false; | ||
262 | if (itemIDs.Count == 0) | ||
263 | return true; | ||
264 | |||
265 | return m_RemoteConnector.DeleteItems(ownerID, itemIDs); | ||
266 | } | ||
267 | |||
268 | public InventoryItemBase GetItem(InventoryItemBase item) | ||
269 | { | ||
270 | if (item == null) | ||
271 | return null; | ||
272 | |||
273 | return m_RemoteConnector.GetItem(item); | ||
274 | } | ||
275 | |||
276 | public InventoryFolderBase GetFolder(InventoryFolderBase folder) | ||
277 | { | ||
278 | m_log.DebugFormat("[XINVENTORY CONNECTOR]: GetFolder {0}", folder.ID); | ||
279 | if (folder == null) | ||
280 | return null; | ||
281 | |||
282 | return m_RemoteConnector.GetFolder(folder); | ||
283 | } | ||
284 | |||
285 | public bool HasInventoryForUser(UUID userID) | ||
286 | { | ||
287 | return false; | ||
288 | } | ||
289 | |||
290 | public List<InventoryItemBase> GetActiveGestures(UUID userId) | ||
291 | { | ||
292 | return new List<InventoryItemBase>(); | ||
293 | } | ||
294 | |||
295 | public int GetAssetPermissions(UUID userID, UUID assetID) | ||
296 | { | ||
297 | return m_RemoteConnector.GetAssetPermissions(userID, assetID); | ||
298 | } | ||
299 | |||
300 | |||
301 | #endregion | ||
302 | |||
303 | |||
304 | } | ||
305 | } | ||
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs index 01359f0..69b247c 100644 --- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs +++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs | |||
@@ -1721,7 +1721,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
1721 | DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); | 1721 | DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); |
1722 | if (m_bypassPermissions) return m_bypassPermissionsValue; | 1722 | if (m_bypassPermissions) return m_bypassPermissionsValue; |
1723 | 1723 | ||
1724 | return true; | 1724 | return GenericObjectPermission(userID, objectID, false); |
1725 | } | 1725 | } |
1726 | 1726 | ||
1727 | private bool CanDelinkObject(UUID userID, UUID objectID) | 1727 | private bool CanDelinkObject(UUID userID, UUID objectID) |
@@ -1729,7 +1729,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
1729 | DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); | 1729 | DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); |
1730 | if (m_bypassPermissions) return m_bypassPermissionsValue; | 1730 | if (m_bypassPermissions) return m_bypassPermissionsValue; |
1731 | 1731 | ||
1732 | return true; | 1732 | return GenericObjectPermission(userID, objectID, false); |
1733 | } | 1733 | } |
1734 | 1734 | ||
1735 | private bool CanBuyLand(UUID userID, ILandObject parcel, Scene scene) | 1735 | private bool CanBuyLand(UUID userID, ILandObject parcel, Scene scene) |
@@ -1894,4 +1894,4 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
1894 | return(false); | 1894 | return(false); |
1895 | } | 1895 | } |
1896 | } | 1896 | } |
1897 | } \ No newline at end of file | 1897 | } |
diff --git a/OpenSim/Region/DataSnapshot/ObjectSnapshot.cs b/OpenSim/Region/DataSnapshot/ObjectSnapshot.cs index f441aa9..6e69902 100644 --- a/OpenSim/Region/DataSnapshot/ObjectSnapshot.cs +++ b/OpenSim/Region/DataSnapshot/ObjectSnapshot.cs | |||
@@ -69,7 +69,7 @@ namespace OpenSim.Region.DataSnapshot.Providers | |||
69 | byte RayEndIsIntersection) { this.Stale = true; }; | 69 | byte RayEndIsIntersection) { this.Stale = true; }; |
70 | client.OnLinkObjects += delegate (IClientAPI remoteClient, uint parent, List<uint> children) | 70 | client.OnLinkObjects += delegate (IClientAPI remoteClient, uint parent, List<uint> children) |
71 | { this.Stale = true; }; | 71 | { this.Stale = true; }; |
72 | client.OnDelinkObjects += delegate(List<uint> primIds) { this.Stale = true; }; | 72 | client.OnDelinkObjects += delegate(List<uint> primIds, IClientAPI clientApi) { this.Stale = true; }; |
73 | client.OnGrabUpdate += delegate(UUID objectID, Vector3 offset, Vector3 grapPos, | 73 | client.OnGrabUpdate += delegate(UUID objectID, Vector3 offset, Vector3 grapPos, |
74 | IClientAPI remoteClient, List<SurfaceTouchEventArgs> surfaceArgs) { this.Stale = true; }; | 74 | IClientAPI remoteClient, List<SurfaceTouchEventArgs> surfaceArgs) { this.Stale = true; }; |
75 | client.OnObjectAttach += delegate(IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, | 75 | client.OnObjectAttach += delegate(IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, |
diff --git a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs index 2b90960..fd43923 100644 --- a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs +++ b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs | |||
@@ -161,6 +161,7 @@ namespace OpenSim.Region.Framework.Interfaces | |||
161 | /// in this prim's inventory.</param> | 161 | /// in this prim's inventory.</param> |
162 | /// <returns>false if the item did not exist, true if the update occurred successfully</returns> | 162 | /// <returns>false if the item did not exist, true if the update occurred successfully</returns> |
163 | bool UpdateInventoryItem(TaskInventoryItem item); | 163 | bool UpdateInventoryItem(TaskInventoryItem item); |
164 | bool UpdateInventoryItem(TaskInventoryItem item, bool fireScriptEvents); | ||
164 | 165 | ||
165 | /// <summary> | 166 | /// <summary> |
166 | /// Remove an item from this entity's inventory | 167 | /// Remove an item from this entity's inventory |
diff --git a/OpenSim/Region/Framework/Interfaces/IRegionModule.cs b/OpenSim/Region/Framework/Interfaces/IRegionModule.cs index 8365fe3..e25a6e8 100644 --- a/OpenSim/Region/Framework/Interfaces/IRegionModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IRegionModule.cs | |||
@@ -30,8 +30,8 @@ using OpenSim.Region.Framework.Scenes; | |||
30 | 30 | ||
31 | namespace OpenSim.Region.Framework.Interfaces | 31 | namespace OpenSim.Region.Framework.Interfaces |
32 | { | 32 | { |
33 | /// <summary> | 33 | /// <summary> |
34 | /// DEPRECATED! Use INonSharedRegionModule or ISharedRegionModule instead | 34 | /// DEPRECATED! Use INonSharedRegionModule or ISharedRegionModule instead |
35 | /// </summary> | 35 | /// </summary> |
36 | public interface IRegionModule | 36 | public interface IRegionModule |
37 | { | 37 | { |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 15b5230..6ebfd31 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | |||
@@ -1941,5 +1941,55 @@ namespace OpenSim.Region.Framework.Scenes | |||
1941 | part.GetProperties(remoteClient); | 1941 | part.GetProperties(remoteClient); |
1942 | } | 1942 | } |
1943 | } | 1943 | } |
1944 | |||
1945 | public void DelinkObjects(List<uint> primIds, IClientAPI client) | ||
1946 | { | ||
1947 | List<SceneObjectPart> parts = new List<SceneObjectPart>(); | ||
1948 | |||
1949 | foreach (uint localID in primIds) | ||
1950 | { | ||
1951 | SceneObjectPart part = GetSceneObjectPart(localID); | ||
1952 | |||
1953 | if (part == null) | ||
1954 | continue; | ||
1955 | |||
1956 | if (Permissions.CanDelinkObject(client.AgentId, part.ParentGroup.RootPart.UUID)) | ||
1957 | parts.Add(part); | ||
1958 | } | ||
1959 | |||
1960 | m_sceneGraph.DelinkObjects(parts); | ||
1961 | } | ||
1962 | |||
1963 | public void LinkObjects(IClientAPI client, uint parentPrimId, List<uint> childPrimIds) | ||
1964 | { | ||
1965 | List<UUID> owners = new List<UUID>(); | ||
1966 | |||
1967 | List<SceneObjectPart> children = new List<SceneObjectPart>(); | ||
1968 | SceneObjectPart root = GetSceneObjectPart(parentPrimId); | ||
1969 | |||
1970 | if (Permissions.CanLinkObject(client.AgentId, root.ParentGroup.RootPart.UUID)) | ||
1971 | return; | ||
1972 | |||
1973 | foreach (uint localID in childPrimIds) | ||
1974 | { | ||
1975 | SceneObjectPart part = GetSceneObjectPart(localID); | ||
1976 | |||
1977 | if (part == null) | ||
1978 | continue; | ||
1979 | |||
1980 | if (!owners.Contains(part.OwnerID)) | ||
1981 | owners.Add(part.OwnerID); | ||
1982 | |||
1983 | if (Permissions.CanLinkObject(client.AgentId, part.ParentGroup.RootPart.UUID)) | ||
1984 | children.Add(part); | ||
1985 | } | ||
1986 | |||
1987 | // Must be all one owner | ||
1988 | // | ||
1989 | if (owners.Count > 1) | ||
1990 | return; | ||
1991 | |||
1992 | m_sceneGraph.LinkObjects(root, children); | ||
1993 | } | ||
1944 | } | 1994 | } |
1945 | } | 1995 | } |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 57587be..61a2956 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -2721,8 +2721,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2721 | client.OnObjectName += m_sceneGraph.PrimName; | 2721 | client.OnObjectName += m_sceneGraph.PrimName; |
2722 | client.OnObjectClickAction += m_sceneGraph.PrimClickAction; | 2722 | client.OnObjectClickAction += m_sceneGraph.PrimClickAction; |
2723 | client.OnObjectMaterial += m_sceneGraph.PrimMaterial; | 2723 | client.OnObjectMaterial += m_sceneGraph.PrimMaterial; |
2724 | client.OnLinkObjects += m_sceneGraph.LinkObjects; | 2724 | client.OnLinkObjects += LinkObjects; |
2725 | client.OnDelinkObjects += m_sceneGraph.DelinkObjects; | 2725 | client.OnDelinkObjects += DelinkObjects; |
2726 | client.OnObjectDuplicate += m_sceneGraph.DuplicateObject; | 2726 | client.OnObjectDuplicate += m_sceneGraph.DuplicateObject; |
2727 | client.OnObjectDuplicateOnRay += doObjectDuplicateOnRay; | 2727 | client.OnObjectDuplicateOnRay += doObjectDuplicateOnRay; |
2728 | client.OnUpdatePrimFlags += m_sceneGraph.UpdatePrimFlags; | 2728 | client.OnUpdatePrimFlags += m_sceneGraph.UpdatePrimFlags; |
@@ -2878,8 +2878,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2878 | client.OnObjectName -= m_sceneGraph.PrimName; | 2878 | client.OnObjectName -= m_sceneGraph.PrimName; |
2879 | client.OnObjectClickAction -= m_sceneGraph.PrimClickAction; | 2879 | client.OnObjectClickAction -= m_sceneGraph.PrimClickAction; |
2880 | client.OnObjectMaterial -= m_sceneGraph.PrimMaterial; | 2880 | client.OnObjectMaterial -= m_sceneGraph.PrimMaterial; |
2881 | client.OnLinkObjects -= m_sceneGraph.LinkObjects; | 2881 | client.OnLinkObjects -= LinkObjects; |
2882 | client.OnDelinkObjects -= m_sceneGraph.DelinkObjects; | 2882 | client.OnDelinkObjects -= DelinkObjects; |
2883 | client.OnObjectDuplicate -= m_sceneGraph.DuplicateObject; | 2883 | client.OnObjectDuplicate -= m_sceneGraph.DuplicateObject; |
2884 | client.OnObjectDuplicateOnRay -= doObjectDuplicateOnRay; | 2884 | client.OnObjectDuplicateOnRay -= doObjectDuplicateOnRay; |
2885 | client.OnUpdatePrimFlags -= m_sceneGraph.UpdatePrimFlags; | 2885 | client.OnUpdatePrimFlags -= m_sceneGraph.UpdatePrimFlags; |
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 1421d0e..ce11267 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs | |||
@@ -1463,20 +1463,21 @@ namespace OpenSim.Region.Framework.Scenes | |||
1463 | /// <param name="client"></param> | 1463 | /// <param name="client"></param> |
1464 | /// <param name="parentPrim"></param> | 1464 | /// <param name="parentPrim"></param> |
1465 | /// <param name="childPrims"></param> | 1465 | /// <param name="childPrims"></param> |
1466 | protected internal void LinkObjects(IClientAPI client, uint parentPrimId, List<uint> childPrimIds) | 1466 | protected internal void LinkObjects(SceneObjectPart root, List<SceneObjectPart> children) |
1467 | { | 1467 | { |
1468 | Monitor.Enter(m_updateLock); | 1468 | Monitor.Enter(m_updateLock); |
1469 | try | 1469 | try |
1470 | { | 1470 | { |
1471 | SceneObjectGroup parentGroup = GetGroupByPrim(parentPrimId); | 1471 | SceneObjectGroup parentGroup = root.ParentGroup; |
1472 | 1472 | ||
1473 | List<SceneObjectGroup> childGroups = new List<SceneObjectGroup>(); | 1473 | List<SceneObjectGroup> childGroups = new List<SceneObjectGroup>(); |
1474 | if (parentGroup != null) | 1474 | if (parentGroup != null) |
1475 | { | 1475 | { |
1476 | // We do this in reverse to get the link order of the prims correct | 1476 | // We do this in reverse to get the link order of the prims correct |
1477 | for (int i = childPrimIds.Count - 1; i >= 0; i--) | 1477 | for (int i = children.Count - 1; i >= 0; i--) |
1478 | { | 1478 | { |
1479 | SceneObjectGroup child = GetGroupByPrim(childPrimIds[i]); | 1479 | SceneObjectGroup child = children[i].ParentGroup; |
1480 | |||
1480 | if (child != null) | 1481 | if (child != null) |
1481 | { | 1482 | { |
1482 | // Make sure no child prim is set for sale | 1483 | // Make sure no child prim is set for sale |
@@ -1509,17 +1510,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1509 | parentGroup.HasGroupChanged = true; | 1510 | parentGroup.HasGroupChanged = true; |
1510 | parentGroup.ScheduleGroupForFullUpdate(); | 1511 | parentGroup.ScheduleGroupForFullUpdate(); |
1511 | 1512 | ||
1512 | // if (client != null) | ||
1513 | // { | ||
1514 | // parentGroup.GetProperties(client); | ||
1515 | // } | ||
1516 | // else | ||
1517 | // { | ||
1518 | // foreach (ScenePresence p in GetScenePresences()) | ||
1519 | // { | ||
1520 | // parentGroup.GetProperties(p.ControllingClient); | ||
1521 | // } | ||
1522 | // } | ||
1523 | } | 1513 | } |
1524 | finally | 1514 | finally |
1525 | { | 1515 | { |
@@ -1531,12 +1521,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1531 | /// Delink a linkset | 1521 | /// Delink a linkset |
1532 | /// </summary> | 1522 | /// </summary> |
1533 | /// <param name="prims"></param> | 1523 | /// <param name="prims"></param> |
1534 | protected internal void DelinkObjects(List<uint> primIds) | 1524 | protected internal void DelinkObjects(List<SceneObjectPart> prims) |
1535 | { | ||
1536 | DelinkObjects(primIds, true); | ||
1537 | } | ||
1538 | |||
1539 | protected internal void DelinkObjects(List<uint> primIds, bool sendEvents) | ||
1540 | { | 1525 | { |
1541 | Monitor.Enter(m_updateLock); | 1526 | Monitor.Enter(m_updateLock); |
1542 | try | 1527 | try |
@@ -1546,9 +1531,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1546 | List<SceneObjectGroup> affectedGroups = new List<SceneObjectGroup>(); | 1531 | List<SceneObjectGroup> affectedGroups = new List<SceneObjectGroup>(); |
1547 | // Look them all up in one go, since that is comparatively expensive | 1532 | // Look them all up in one go, since that is comparatively expensive |
1548 | // | 1533 | // |
1549 | foreach (uint primID in primIds) | 1534 | foreach (SceneObjectPart part in prims) |
1550 | { | 1535 | { |
1551 | SceneObjectPart part = m_parentScene.GetSceneObjectPart(primID); | ||
1552 | if (part != null) | 1536 | if (part != null) |
1553 | { | 1537 | { |
1554 | if (part.ParentGroup.Children.Count != 1) // Skip single | 1538 | if (part.ParentGroup.Children.Count != 1) // Skip single |
@@ -1563,17 +1547,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
1563 | affectedGroups.Add(group); | 1547 | affectedGroups.Add(group); |
1564 | } | 1548 | } |
1565 | } | 1549 | } |
1566 | else | ||
1567 | { | ||
1568 | m_log.ErrorFormat("Viewer requested unlink of nonexistent part {0}", primID); | ||
1569 | } | ||
1570 | } | 1550 | } |
1571 | 1551 | ||
1572 | foreach (SceneObjectPart child in childParts) | 1552 | foreach (SceneObjectPart child in childParts) |
1573 | { | 1553 | { |
1574 | // Unlink all child parts from their groups | 1554 | // Unlink all child parts from their groups |
1575 | // | 1555 | // |
1576 | child.ParentGroup.DelinkFromGroup(child, sendEvents); | 1556 | child.ParentGroup.DelinkFromGroup(child, true); |
1577 | } | 1557 | } |
1578 | 1558 | ||
1579 | foreach (SceneObjectPart root in rootParts) | 1559 | foreach (SceneObjectPart root in rootParts) |
@@ -1628,12 +1608,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
1628 | List<uint> linkIDs = new List<uint>(); | 1608 | List<uint> linkIDs = new List<uint>(); |
1629 | 1609 | ||
1630 | foreach (SceneObjectPart newChild in newSet) | 1610 | foreach (SceneObjectPart newChild in newSet) |
1631 | { | ||
1632 | newChild.UpdateFlag = 0; | 1611 | newChild.UpdateFlag = 0; |
1633 | linkIDs.Add(newChild.LocalId); | ||
1634 | } | ||
1635 | 1612 | ||
1636 | LinkObjects(null, newRoot.LocalId, linkIDs); | 1613 | LinkObjects(newRoot, newSet); |
1637 | if (!affectedGroups.Contains(newRoot.ParentGroup)) | 1614 | if (!affectedGroups.Contains(newRoot.ParentGroup)) |
1638 | affectedGroups.Add(newRoot.ParentGroup); | 1615 | affectedGroups.Add(newRoot.ParentGroup); |
1639 | } | 1616 | } |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index 3b1b567..4da63c0 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs | |||
@@ -609,43 +609,50 @@ namespace OpenSim.Region.Framework.Scenes | |||
609 | /// <returns>false if the item did not exist, true if the update occurred successfully</returns> | 609 | /// <returns>false if the item did not exist, true if the update occurred successfully</returns> |
610 | public bool UpdateInventoryItem(TaskInventoryItem item) | 610 | public bool UpdateInventoryItem(TaskInventoryItem item) |
611 | { | 611 | { |
612 | lock (m_items) | 612 | return UpdateInventoryItem(item, true); |
613 | } | ||
614 | |||
615 | public bool UpdateInventoryItem(TaskInventoryItem item, bool fireScriptEvents) | ||
616 | { | ||
617 | lock(m_items) | ||
613 | { | 618 | { |
614 | if (m_items.ContainsKey(item.ItemID)) | 619 | if (m_items.ContainsKey(item.ItemID)) |
615 | { | 620 | { |
616 | item.ParentID = m_part.UUID; | 621 | if (m_items.ContainsKey(item.ItemID)) |
617 | item.ParentPartID = m_part.UUID; | ||
618 | item.Flags = m_items[item.ItemID].Flags; | ||
619 | |||
620 | // If group permissions have been set on, check that the groupID is up to date in case it has | ||
621 | // changed since permissions were last set. | ||
622 | if (item.GroupPermissions != (uint)PermissionMask.None) | ||
623 | item.GroupID = m_part.GroupID; | ||
624 | |||
625 | if (item.AssetID == UUID.Zero) | ||
626 | { | 622 | { |
627 | item.AssetID = m_items[item.ItemID].AssetID; | 623 | item.ParentID = m_part.UUID; |
624 | item.ParentPartID = m_part.UUID; | ||
625 | item.Flags = m_items[item.ItemID].Flags; | ||
626 | |||
627 | // If group permissions have been set on, check that the groupID is up to date in case it has | ||
628 | // changed since permissions were last set. | ||
629 | if (item.GroupPermissions != (uint)PermissionMask.None) | ||
630 | item.GroupID = m_part.GroupID; | ||
631 | |||
632 | if (item.AssetID == UUID.Zero) | ||
633 | { | ||
634 | item.AssetID = m_items[item.ItemID].AssetID; | ||
635 | } | ||
636 | m_items[item.ItemID] = item; | ||
637 | m_inventorySerial++; | ||
638 | if (fireScriptEvents) | ||
639 | m_part.TriggerScriptChangedEvent(Changed.INVENTORY); | ||
640 | HasInventoryChanged = true; | ||
641 | m_part.ParentGroup.HasGroupChanged = true; | ||
642 | return true; | ||
643 | } | ||
644 | else | ||
645 | { | ||
646 | m_log.ErrorFormat( | ||
647 | "[PRIM INVENTORY]: " + | ||
648 | "Tried to retrieve item ID {0} from prim {1}, {2} at {3} in {4} but the item does not exist in this inventory", | ||
649 | item.ItemID, m_part.Name, m_part.UUID, | ||
650 | m_part.AbsolutePosition, m_part.ParentGroup.Scene.RegionInfo.RegionName); | ||
628 | } | 651 | } |
629 | 652 | ||
630 | m_items[item.ItemID] = item; | ||
631 | m_inventorySerial++; | ||
632 | m_part.TriggerScriptChangedEvent(Changed.INVENTORY); | ||
633 | HasInventoryChanged = true; | ||
634 | m_part.ParentGroup.HasGroupChanged = true; | ||
635 | |||
636 | return true; | ||
637 | } | ||
638 | else | ||
639 | { | ||
640 | m_log.ErrorFormat( | ||
641 | "[PRIM INVENTORY]: " + | ||
642 | "Tried to retrieve item ID {0} from prim {1}, {2} at {3} in {4} but the item does not exist in this inventory", | ||
643 | item.ItemID, m_part.Name, m_part.UUID, | ||
644 | m_part.AbsolutePosition, m_part.ParentGroup.Scene.RegionInfo.RegionName); | ||
645 | } | 653 | } |
654 | return false; | ||
646 | } | 655 | } |
647 | |||
648 | return false; | ||
649 | } | 656 | } |
650 | 657 | ||
651 | /// <summary> | 658 | /// <summary> |
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IInventoryItem.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IInventoryItem.cs index 5fac189..16cd7e4 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IInventoryItem.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IInventoryItem.cs | |||
@@ -39,6 +39,6 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | |||
39 | { | 39 | { |
40 | int Type { get; } | 40 | int Type { get; } |
41 | UUID AssetID { get; } | 41 | UUID AssetID { get; } |
42 | T RetreiveAsset<T>() where T : Asset, new(); | 42 | T RetrieveAsset<T>() where T : Asset, new(); |
43 | } | 43 | } |
44 | } | 44 | } |
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/InventoryItem.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/InventoryItem.cs index 5bf29d7..bf85cbc 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/InventoryItem.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/InventoryItem.cs | |||
@@ -39,11 +39,11 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | |||
39 | public class InventoryItem : IInventoryItem | 39 | public class InventoryItem : IInventoryItem |
40 | { | 40 | { |
41 | TaskInventoryItem m_privateItem; | 41 | TaskInventoryItem m_privateItem; |
42 | Scene m_rootSceene; | 42 | Scene m_rootScene; |
43 | 43 | ||
44 | public InventoryItem(Scene rootScene, TaskInventoryItem internalItem) | 44 | public InventoryItem(Scene rootScene, TaskInventoryItem internalItem) |
45 | { | 45 | { |
46 | m_rootSceene = rootScene; | 46 | m_rootScene = rootScene; |
47 | m_privateItem = internalItem; | 47 | m_privateItem = internalItem; |
48 | } | 48 | } |
49 | 49 | ||
@@ -82,9 +82,9 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | |||
82 | public UUID AssetID { get { return m_privateItem.AssetID; } } | 82 | public UUID AssetID { get { return m_privateItem.AssetID; } } |
83 | 83 | ||
84 | // This method exposes OpenSim/OpenMetaverse internals and needs to be replaced with a IAsset specific to MRM. | 84 | // This method exposes OpenSim/OpenMetaverse internals and needs to be replaced with a IAsset specific to MRM. |
85 | public T RetreiveAsset<T>() where T : OpenMetaverse.Assets.Asset, new() | 85 | public T RetrieveAsset<T>() where T : OpenMetaverse.Assets.Asset, new() |
86 | { | 86 | { |
87 | AssetBase a = m_rootSceene.AssetService.Get(AssetID.ToString()); | 87 | AssetBase a = m_rootScene.AssetService.Get(AssetID.ToString()); |
88 | T result = new T(); | 88 | T result = new T(); |
89 | 89 | ||
90 | if ((sbyte)result.AssetType != a.Type) | 90 | if ((sbyte)result.AssetType != a.Type) |
diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs index d8c0ba5..f719683 100644 --- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs +++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs | |||
@@ -261,13 +261,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools | |||
261 | // } | 261 | // } |
262 | //} | 262 | //} |
263 | 263 | ||
264 | public object GetCompilerOutput(UUID assetID) | 264 | public string GetCompilerOutput(string assetID) |
265 | { | 265 | { |
266 | return Path.Combine(ScriptEnginesPath, Path.Combine( | 266 | return Path.Combine(ScriptEnginesPath, Path.Combine( |
267 | m_scriptEngine.World.RegionInfo.RegionID.ToString(), | 267 | m_scriptEngine.World.RegionInfo.RegionID.ToString(), |
268 | FilePrefix + "_compiled_" + assetID + ".dll")); | 268 | FilePrefix + "_compiled_" + assetID + ".dll")); |
269 | } | 269 | } |
270 | 270 | ||
271 | public string GetCompilerOutput(UUID assetID) | ||
272 | { | ||
273 | return GetCompilerOutput(assetID.ToString()); | ||
274 | } | ||
275 | |||
271 | /// <summary> | 276 | /// <summary> |
272 | /// Converts script from LSL to CS and calls CompileFromCSText | 277 | /// Converts script from LSL to CS and calls CompileFromCSText |
273 | /// </summary> | 278 | /// </summary> |
@@ -279,9 +284,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools | |||
279 | linemap = null; | 284 | linemap = null; |
280 | m_warnings.Clear(); | 285 | m_warnings.Clear(); |
281 | 286 | ||
282 | assembly = Path.Combine(ScriptEnginesPath, Path.Combine( | 287 | assembly = GetCompilerOutput(asset); |
283 | m_scriptEngine.World.RegionInfo.RegionID.ToString(), | ||
284 | FilePrefix + "_compiled_" + asset + ".dll")); | ||
285 | 288 | ||
286 | if (!Directory.Exists(ScriptEnginesPath)) | 289 | if (!Directory.Exists(ScriptEnginesPath)) |
287 | { | 290 | { |
diff --git a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs index 34f7dcc..16b05df 100644 --- a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs +++ b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs | |||
@@ -91,7 +91,7 @@ namespace OpenSim.Server.Handlers.Asset | |||
91 | sr.Close(); | 91 | sr.Close(); |
92 | body = body.Trim(); | 92 | body = body.Trim(); |
93 | 93 | ||
94 | m_log.DebugFormat("[XXX]: query String: {0}", body); | 94 | //m_log.DebugFormat("[XXX]: query String: {0}", body); |
95 | 95 | ||
96 | try | 96 | try |
97 | { | 97 | { |
@@ -144,6 +144,8 @@ namespace OpenSim.Server.Handlers.Asset | |||
144 | return HandleGetActiveGestures(request); | 144 | return HandleGetActiveGestures(request); |
145 | case "GETASSETPERMISSIONS": | 145 | case "GETASSETPERMISSIONS": |
146 | return HandleGetAssetPermissions(request); | 146 | return HandleGetAssetPermissions(request); |
147 | case "GETSYSTEMFOLDERS": | ||
148 | return HandleGetSystemFolders(request); | ||
147 | } | 149 | } |
148 | m_log.DebugFormat("[XINVENTORY HANDLER]: unknown method request: {0}", method); | 150 | m_log.DebugFormat("[XINVENTORY HANDLER]: unknown method request: {0}", method); |
149 | } | 151 | } |
@@ -197,7 +199,7 @@ namespace OpenSim.Server.Handlers.Asset | |||
197 | 199 | ||
198 | return ms.ToArray(); | 200 | return ms.ToArray(); |
199 | } | 201 | } |
200 | 202 | ||
201 | byte[] HandleCreateUserInventory(Dictionary<string,object> request) | 203 | byte[] HandleCreateUserInventory(Dictionary<string,object> request) |
202 | { | 204 | { |
203 | Dictionary<string,object> result = new Dictionary<string,object>(); | 205 | Dictionary<string,object> result = new Dictionary<string,object>(); |
@@ -211,7 +213,7 @@ namespace OpenSim.Server.Handlers.Asset | |||
211 | result["RESULT"] = "False"; | 213 | result["RESULT"] = "False"; |
212 | 214 | ||
213 | string xmlString = ServerUtils.BuildXmlResponse(result); | 215 | string xmlString = ServerUtils.BuildXmlResponse(result); |
214 | m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); | 216 | //m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); |
215 | UTF8Encoding encoding = new UTF8Encoding(); | 217 | UTF8Encoding encoding = new UTF8Encoding(); |
216 | return encoding.GetBytes(xmlString); | 218 | return encoding.GetBytes(xmlString); |
217 | } | 219 | } |
@@ -226,12 +228,20 @@ namespace OpenSim.Server.Handlers.Asset | |||
226 | 228 | ||
227 | List<InventoryFolderBase> folders = m_InventoryService.GetInventorySkeleton(new UUID(request["PRINCIPAL"].ToString())); | 229 | List<InventoryFolderBase> folders = m_InventoryService.GetInventorySkeleton(new UUID(request["PRINCIPAL"].ToString())); |
228 | 230 | ||
231 | Dictionary<string, object> sfolders = new Dictionary<string, object>(); | ||
229 | if (folders != null) | 232 | if (folders != null) |
233 | { | ||
234 | int i = 0; | ||
230 | foreach (InventoryFolderBase f in folders) | 235 | foreach (InventoryFolderBase f in folders) |
231 | result[f.ID.ToString()] = EncodeFolder(f); | 236 | { |
237 | sfolders["folder_" + i.ToString()] = EncodeFolder(f); | ||
238 | i++; | ||
239 | } | ||
240 | } | ||
241 | result["FOLDERS"] = sfolders; | ||
232 | 242 | ||
233 | string xmlString = ServerUtils.BuildXmlResponse(result); | 243 | string xmlString = ServerUtils.BuildXmlResponse(result); |
234 | m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); | 244 | //m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); |
235 | UTF8Encoding encoding = new UTF8Encoding(); | 245 | UTF8Encoding encoding = new UTF8Encoding(); |
236 | return encoding.GetBytes(xmlString); | 246 | return encoding.GetBytes(xmlString); |
237 | } | 247 | } |
@@ -244,10 +254,10 @@ namespace OpenSim.Server.Handlers.Asset | |||
244 | UUID.TryParse(request["PRINCIPAL"].ToString(), out principal); | 254 | UUID.TryParse(request["PRINCIPAL"].ToString(), out principal); |
245 | InventoryFolderBase rfolder = m_InventoryService.GetRootFolder(principal); | 255 | InventoryFolderBase rfolder = m_InventoryService.GetRootFolder(principal); |
246 | if (rfolder != null) | 256 | if (rfolder != null) |
247 | result[rfolder.ID.ToString()] = EncodeFolder(rfolder); | 257 | result["folder"] = EncodeFolder(rfolder); |
248 | 258 | ||
249 | string xmlString = ServerUtils.BuildXmlResponse(result); | 259 | string xmlString = ServerUtils.BuildXmlResponse(result); |
250 | m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); | 260 | //m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); |
251 | UTF8Encoding encoding = new UTF8Encoding(); | 261 | UTF8Encoding encoding = new UTF8Encoding(); |
252 | return encoding.GetBytes(xmlString); | 262 | return encoding.GetBytes(xmlString); |
253 | } | 263 | } |
@@ -261,10 +271,10 @@ namespace OpenSim.Server.Handlers.Asset | |||
261 | Int32.TryParse(request["TYPE"].ToString(), out type); | 271 | Int32.TryParse(request["TYPE"].ToString(), out type); |
262 | InventoryFolderBase folder = m_InventoryService.GetFolderForType(principal, (AssetType)type); | 272 | InventoryFolderBase folder = m_InventoryService.GetFolderForType(principal, (AssetType)type); |
263 | if (folder != null) | 273 | if (folder != null) |
264 | result[folder.ID.ToString()] = EncodeFolder(folder); | 274 | result["folder"] = EncodeFolder(folder); |
265 | 275 | ||
266 | string xmlString = ServerUtils.BuildXmlResponse(result); | 276 | string xmlString = ServerUtils.BuildXmlResponse(result); |
267 | m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); | 277 | //m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); |
268 | UTF8Encoding encoding = new UTF8Encoding(); | 278 | UTF8Encoding encoding = new UTF8Encoding(); |
269 | return encoding.GetBytes(xmlString); | 279 | return encoding.GetBytes(xmlString); |
270 | } | 280 | } |
@@ -281,18 +291,26 @@ namespace OpenSim.Server.Handlers.Asset | |||
281 | if (icoll != null) | 291 | if (icoll != null) |
282 | { | 292 | { |
283 | Dictionary<string, object> folders = new Dictionary<string, object>(); | 293 | Dictionary<string, object> folders = new Dictionary<string, object>(); |
294 | int i = 0; | ||
284 | foreach (InventoryFolderBase f in icoll.Folders) | 295 | foreach (InventoryFolderBase f in icoll.Folders) |
285 | folders[f.ID.ToString()] = EncodeFolder(f); | 296 | { |
297 | folders["folder_" + i.ToString()] = EncodeFolder(f); | ||
298 | i++; | ||
299 | } | ||
286 | result["FOLDERS"] = folders; | 300 | result["FOLDERS"] = folders; |
287 | 301 | ||
302 | i = 0; | ||
288 | Dictionary<string, object> items = new Dictionary<string, object>(); | 303 | Dictionary<string, object> items = new Dictionary<string, object>(); |
289 | foreach (InventoryItemBase i in icoll.Items) | 304 | foreach (InventoryItemBase it in icoll.Items) |
290 | items[i.ID.ToString()] = EncodeItem(i); | 305 | { |
306 | items["item_" + i.ToString()] = EncodeItem(it); | ||
307 | i++; | ||
308 | } | ||
291 | result["ITEMS"] = items; | 309 | result["ITEMS"] = items; |
292 | } | 310 | } |
293 | 311 | ||
294 | string xmlString = ServerUtils.BuildXmlResponse(result); | 312 | string xmlString = ServerUtils.BuildXmlResponse(result); |
295 | m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); | 313 | //m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); |
296 | UTF8Encoding encoding = new UTF8Encoding(); | 314 | UTF8Encoding encoding = new UTF8Encoding(); |
297 | return encoding.GetBytes(xmlString); | 315 | return encoding.GetBytes(xmlString); |
298 | } | 316 | } |
@@ -306,12 +324,21 @@ namespace OpenSim.Server.Handlers.Asset | |||
306 | UUID.TryParse(request["FOLDER"].ToString(), out folderID); | 324 | UUID.TryParse(request["FOLDER"].ToString(), out folderID); |
307 | 325 | ||
308 | List<InventoryItemBase> items = m_InventoryService.GetFolderItems(principal, folderID); | 326 | List<InventoryItemBase> items = m_InventoryService.GetFolderItems(principal, folderID); |
327 | Dictionary<string, object> sitems = new Dictionary<string, object>(); | ||
328 | |||
309 | if (items != null) | 329 | if (items != null) |
330 | { | ||
331 | int i = 0; | ||
310 | foreach (InventoryItemBase item in items) | 332 | foreach (InventoryItemBase item in items) |
311 | result[item.ID.ToString()] = EncodeItem(item); | 333 | { |
334 | sitems["item_" + i.ToString()] = EncodeItem(item); | ||
335 | i++; | ||
336 | } | ||
337 | } | ||
338 | result["ITEMS"] = sitems; | ||
312 | 339 | ||
313 | string xmlString = ServerUtils.BuildXmlResponse(result); | 340 | string xmlString = ServerUtils.BuildXmlResponse(result); |
314 | m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); | 341 | //m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); |
315 | UTF8Encoding encoding = new UTF8Encoding(); | 342 | UTF8Encoding encoding = new UTF8Encoding(); |
316 | return encoding.GetBytes(xmlString); | 343 | return encoding.GetBytes(xmlString); |
317 | } | 344 | } |
@@ -481,10 +508,10 @@ namespace OpenSim.Server.Handlers.Asset | |||
481 | InventoryItemBase item = new InventoryItemBase(id); | 508 | InventoryItemBase item = new InventoryItemBase(id); |
482 | item = m_InventoryService.GetItem(item); | 509 | item = m_InventoryService.GetItem(item); |
483 | if (item != null) | 510 | if (item != null) |
484 | result[item.ID.ToString()] = EncodeItem(item); | 511 | result["item"] = EncodeItem(item); |
485 | 512 | ||
486 | string xmlString = ServerUtils.BuildXmlResponse(result); | 513 | string xmlString = ServerUtils.BuildXmlResponse(result); |
487 | m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); | 514 | //m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); |
488 | UTF8Encoding encoding = new UTF8Encoding(); | 515 | UTF8Encoding encoding = new UTF8Encoding(); |
489 | return encoding.GetBytes(xmlString); | 516 | return encoding.GetBytes(xmlString); |
490 | } | 517 | } |
@@ -498,10 +525,10 @@ namespace OpenSim.Server.Handlers.Asset | |||
498 | InventoryFolderBase folder = new InventoryFolderBase(id); | 525 | InventoryFolderBase folder = new InventoryFolderBase(id); |
499 | folder = m_InventoryService.GetFolder(folder); | 526 | folder = m_InventoryService.GetFolder(folder); |
500 | if (folder != null) | 527 | if (folder != null) |
501 | result[folder.ID.ToString()] = EncodeFolder(folder); | 528 | result["folder"] = EncodeFolder(folder); |
502 | 529 | ||
503 | string xmlString = ServerUtils.BuildXmlResponse(result); | 530 | string xmlString = ServerUtils.BuildXmlResponse(result); |
504 | m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); | 531 | //m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); |
505 | UTF8Encoding encoding = new UTF8Encoding(); | 532 | UTF8Encoding encoding = new UTF8Encoding(); |
506 | return encoding.GetBytes(xmlString); | 533 | return encoding.GetBytes(xmlString); |
507 | } | 534 | } |
@@ -513,12 +540,20 @@ namespace OpenSim.Server.Handlers.Asset | |||
513 | UUID.TryParse(request["PRINCIPAL"].ToString(), out principal); | 540 | UUID.TryParse(request["PRINCIPAL"].ToString(), out principal); |
514 | 541 | ||
515 | List<InventoryItemBase> gestures = m_InventoryService.GetActiveGestures(principal); | 542 | List<InventoryItemBase> gestures = m_InventoryService.GetActiveGestures(principal); |
543 | Dictionary<string, object> items = new Dictionary<string, object>(); | ||
516 | if (gestures != null) | 544 | if (gestures != null) |
545 | { | ||
546 | int i = 0; | ||
517 | foreach (InventoryItemBase item in gestures) | 547 | foreach (InventoryItemBase item in gestures) |
518 | result[item.ID.ToString()] = EncodeItem(item); | 548 | { |
549 | items["item_" + i.ToString()] = EncodeItem(item); | ||
550 | i++; | ||
551 | } | ||
552 | } | ||
553 | result["ITEMS"] = items; | ||
519 | 554 | ||
520 | string xmlString = ServerUtils.BuildXmlResponse(result); | 555 | string xmlString = ServerUtils.BuildXmlResponse(result); |
521 | m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); | 556 | //m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); |
522 | UTF8Encoding encoding = new UTF8Encoding(); | 557 | UTF8Encoding encoding = new UTF8Encoding(); |
523 | return encoding.GetBytes(xmlString); | 558 | return encoding.GetBytes(xmlString); |
524 | } | 559 | } |
@@ -535,7 +570,31 @@ namespace OpenSim.Server.Handlers.Asset | |||
535 | 570 | ||
536 | result["RESULT"] = perms.ToString(); | 571 | result["RESULT"] = perms.ToString(); |
537 | string xmlString = ServerUtils.BuildXmlResponse(result); | 572 | string xmlString = ServerUtils.BuildXmlResponse(result); |
538 | m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); | 573 | //m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); |
574 | UTF8Encoding encoding = new UTF8Encoding(); | ||
575 | return encoding.GetBytes(xmlString); | ||
576 | } | ||
577 | |||
578 | byte[] HandleGetSystemFolders(Dictionary<string, object> request) | ||
579 | { | ||
580 | Dictionary<string, object> result = new Dictionary<string, object>(); | ||
581 | UUID principal = UUID.Zero; | ||
582 | UUID.TryParse(request["PRINCIPAL"].ToString(), out principal); | ||
583 | |||
584 | Dictionary<AssetType, InventoryFolderBase> sfolders = GetSystemFolders(principal); | ||
585 | //m_log.DebugFormat("[XXX]: SystemFolders got {0} folders", sfolders.Count); | ||
586 | |||
587 | Dictionary<string, object> folders = new Dictionary<string, object>(); | ||
588 | int i = 0; | ||
589 | foreach (KeyValuePair<AssetType, InventoryFolderBase> kvp in sfolders) | ||
590 | { | ||
591 | folders["folder_" + i.ToString()] = EncodeFolder(kvp.Value); | ||
592 | i++; | ||
593 | } | ||
594 | result["FOLDERS"] = folders; | ||
595 | |||
596 | string xmlString = ServerUtils.BuildXmlResponse(result); | ||
597 | //m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); | ||
539 | UTF8Encoding encoding = new UTF8Encoding(); | 598 | UTF8Encoding encoding = new UTF8Encoding(); |
540 | return encoding.GetBytes(xmlString); | 599 | return encoding.GetBytes(xmlString); |
541 | } | 600 | } |
@@ -569,7 +628,7 @@ namespace OpenSim.Server.Handlers.Asset | |||
569 | ret["Flags"] = item.Flags.ToString(); | 628 | ret["Flags"] = item.Flags.ToString(); |
570 | ret["Folder"] = item.Folder.ToString(); | 629 | ret["Folder"] = item.Folder.ToString(); |
571 | ret["GroupID"] = item.GroupID.ToString(); | 630 | ret["GroupID"] = item.GroupID.ToString(); |
572 | ret["GroupedOwned"] = item.GroupOwned.ToString(); | 631 | ret["GroupOwned"] = item.GroupOwned.ToString(); |
573 | ret["GroupPermissions"] = item.GroupPermissions.ToString(); | 632 | ret["GroupPermissions"] = item.GroupPermissions.ToString(); |
574 | ret["ID"] = item.ID.ToString(); | 633 | ret["ID"] = item.ID.ToString(); |
575 | ret["InvType"] = item.InvType.ToString(); | 634 | ret["InvType"] = item.InvType.ToString(); |
@@ -623,5 +682,31 @@ namespace OpenSim.Server.Handlers.Asset | |||
623 | 682 | ||
624 | return item; | 683 | return item; |
625 | } | 684 | } |
685 | |||
686 | #region Extra | ||
687 | private Dictionary<AssetType, InventoryFolderBase> GetSystemFolders(UUID userID) | ||
688 | { | ||
689 | InventoryFolderBase root = m_InventoryService.GetRootFolder(userID); | ||
690 | if (root != null) | ||
691 | { | ||
692 | InventoryCollection content = m_InventoryService.GetFolderContent(userID, root.ID); | ||
693 | if (content != null) | ||
694 | { | ||
695 | Dictionary<AssetType, InventoryFolderBase> folders = new Dictionary<AssetType, InventoryFolderBase>(); | ||
696 | foreach (InventoryFolderBase folder in content.Folders) | ||
697 | { | ||
698 | if ((folder.Type != (short)AssetType.Folder) && (folder.Type != (short)AssetType.Unknown)) | ||
699 | folders[(AssetType)folder.Type] = folder; | ||
700 | } | ||
701 | // Put the root folder there, as type Folder | ||
702 | folders[AssetType.Folder] = root; | ||
703 | return folders; | ||
704 | } | ||
705 | } | ||
706 | m_log.WarnFormat("[XINVENTORY SERVICE]: System folders for {0} not found", userID); | ||
707 | return new Dictionary<AssetType, InventoryFolderBase>(); | ||
708 | } | ||
709 | #endregion | ||
710 | |||
626 | } | 711 | } |
627 | } | 712 | } |
diff --git a/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs b/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs index aaa958b..daf2704 100644 --- a/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs +++ b/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs | |||
@@ -72,6 +72,9 @@ namespace OpenSim.Server.Handlers.Login | |||
72 | string last = requestData["last"].ToString(); | 72 | string last = requestData["last"].ToString(); |
73 | string passwd = requestData["passwd"].ToString(); | 73 | string passwd = requestData["passwd"].ToString(); |
74 | string startLocation = string.Empty; | 74 | string startLocation = string.Empty; |
75 | UUID scopeID = UUID.Zero; | ||
76 | if (requestData["scope_id"] != null) | ||
77 | scopeID = new UUID(requestData["scope_id"].ToString()); | ||
75 | if (requestData.ContainsKey("start")) | 78 | if (requestData.ContainsKey("start")) |
76 | startLocation = requestData["start"].ToString(); | 79 | startLocation = requestData["start"].ToString(); |
77 | 80 | ||
@@ -83,7 +86,7 @@ namespace OpenSim.Server.Handlers.Login | |||
83 | m_log.InfoFormat("[LOGIN]: XMLRPC Login Requested for {0} {1}, starting in {2}, using {3}", first, last, startLocation, clientVersion); | 86 | m_log.InfoFormat("[LOGIN]: XMLRPC Login Requested for {0} {1}, starting in {2}, using {3}", first, last, startLocation, clientVersion); |
84 | 87 | ||
85 | LoginResponse reply = null; | 88 | LoginResponse reply = null; |
86 | reply = m_LocalService.Login(first, last, passwd, startLocation, remoteClient); | 89 | reply = m_LocalService.Login(first, last, passwd, startLocation, scopeID, remoteClient); |
87 | 90 | ||
88 | XmlRpcResponse response = new XmlRpcResponse(); | 91 | XmlRpcResponse response = new XmlRpcResponse(); |
89 | response.Value = reply.ToHashtable(); | 92 | response.Value = reply.ToHashtable(); |
@@ -109,10 +112,15 @@ namespace OpenSim.Server.Handlers.Login | |||
109 | if (map.ContainsKey("start")) | 112 | if (map.ContainsKey("start")) |
110 | startLocation = map["start"].AsString(); | 113 | startLocation = map["start"].AsString(); |
111 | 114 | ||
115 | UUID scopeID = UUID.Zero; | ||
116 | |||
117 | if (map.ContainsKey("scope_id")) | ||
118 | scopeID = new UUID(map["scope_id"].AsString()); | ||
119 | |||
112 | m_log.Info("[LOGIN]: LLSD Login Requested for: '" + map["first"].AsString() + "' '" + map["last"].AsString() + "' / " + startLocation); | 120 | m_log.Info("[LOGIN]: LLSD Login Requested for: '" + map["first"].AsString() + "' '" + map["last"].AsString() + "' / " + startLocation); |
113 | 121 | ||
114 | LoginResponse reply = null; | 122 | LoginResponse reply = null; |
115 | reply = m_LocalService.Login(map["first"].AsString(), map["last"].AsString(), map["passwd"].AsString(), startLocation, remoteClient); | 123 | reply = m_LocalService.Login(map["first"].AsString(), map["last"].AsString(), map["passwd"].AsString(), startLocation, scopeID, remoteClient); |
116 | return reply.ToOSDMap(); | 124 | return reply.ToOSDMap(); |
117 | 125 | ||
118 | } | 126 | } |
diff --git a/OpenSim/Services/AssetService/AssetService.cs b/OpenSim/Services/AssetService/AssetService.cs index ed87f3f..4e512e7 100644 --- a/OpenSim/Services/AssetService/AssetService.cs +++ b/OpenSim/Services/AssetService/AssetService.cs | |||
@@ -106,7 +106,10 @@ namespace OpenSim.Services.AssetService | |||
106 | return null; | 106 | return null; |
107 | 107 | ||
108 | AssetBase asset = m_Database.GetAsset(assetID); | 108 | AssetBase asset = m_Database.GetAsset(assetID); |
109 | return asset.Metadata; | 109 | if (asset != null) |
110 | return asset.Metadata; | ||
111 | |||
112 | return null; | ||
110 | } | 113 | } |
111 | 114 | ||
112 | public byte[] GetData(string id) | 115 | public byte[] GetData(string id) |
diff --git a/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs b/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs index 0cc1978..52294da 100644 --- a/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs +++ b/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs | |||
@@ -112,8 +112,15 @@ namespace OpenSim.Services.Connectors | |||
112 | 112 | ||
113 | List<InventoryFolderBase> folders = new List<InventoryFolderBase>(); | 113 | List<InventoryFolderBase> folders = new List<InventoryFolderBase>(); |
114 | 114 | ||
115 | foreach (Object o in ret.Values) | 115 | try |
116 | folders.Add(BuildFolder((Dictionary<string,object>)o)); | 116 | { |
117 | foreach (Object o in ret.Values) | ||
118 | folders.Add(BuildFolder((Dictionary<string, object>)o)); | ||
119 | } | ||
120 | catch (Exception e) | ||
121 | { | ||
122 | m_log.DebugFormat("[XINVENTORY CONNECTOR STUB]: Exception unwrapping folder list: {0}", e.Message); | ||
123 | } | ||
117 | 124 | ||
118 | return folders; | 125 | return folders; |
119 | } | 126 | } |
@@ -130,7 +137,7 @@ namespace OpenSim.Services.Connectors | |||
130 | if (ret.Count == 0) | 137 | if (ret.Count == 0) |
131 | return null; | 138 | return null; |
132 | 139 | ||
133 | return BuildFolder(ret); | 140 | return BuildFolder((Dictionary<string, object>)ret["folder"]); |
134 | } | 141 | } |
135 | 142 | ||
136 | public InventoryFolderBase GetFolderForType(UUID principalID, AssetType type) | 143 | public InventoryFolderBase GetFolderForType(UUID principalID, AssetType type) |
@@ -146,7 +153,7 @@ namespace OpenSim.Services.Connectors | |||
146 | if (ret.Count == 0) | 153 | if (ret.Count == 0) |
147 | return null; | 154 | return null; |
148 | 155 | ||
149 | return BuildFolder(ret); | 156 | return BuildFolder((Dictionary<string, object>)ret["folder"]); |
150 | } | 157 | } |
151 | 158 | ||
152 | public InventoryCollection GetFolderContent(UUID principalID, UUID folderID) | 159 | public InventoryCollection GetFolderContent(UUID principalID, UUID folderID) |
@@ -173,10 +180,17 @@ namespace OpenSim.Services.Connectors | |||
173 | Dictionary<string,object> items = | 180 | Dictionary<string,object> items = |
174 | (Dictionary<string,object>)ret["ITEMS"]; | 181 | (Dictionary<string,object>)ret["ITEMS"]; |
175 | 182 | ||
176 | foreach (Object o in folders.Values) | 183 | try |
177 | inventory.Folders.Add(BuildFolder((Dictionary<string,object>)o)); | 184 | { |
178 | foreach (Object o in items.Values) | 185 | foreach (Object o in folders.Values) // getting the values directly, we don't care about the keys folder_i |
179 | inventory.Items.Add(BuildItem((Dictionary<string,object>)o)); | 186 | inventory.Folders.Add(BuildFolder((Dictionary<string, object>)o)); |
187 | foreach (Object o in items.Values) // getting the values directly, we don't care about the keys item_i | ||
188 | inventory.Items.Add(BuildItem((Dictionary<string, object>)o)); | ||
189 | } | ||
190 | catch (Exception e) | ||
191 | { | ||
192 | m_log.DebugFormat("[XINVENTORY CONNECTOR STUB]: Exception unwrapping content list: {0}", e.Message); | ||
193 | } | ||
180 | 194 | ||
181 | return inventory; | 195 | return inventory; |
182 | } | 196 | } |
@@ -194,13 +208,12 @@ namespace OpenSim.Services.Connectors | |||
194 | if (ret.Count == 0) | 208 | if (ret.Count == 0) |
195 | return null; | 209 | return null; |
196 | 210 | ||
197 | 211 | Dictionary<string, object> items = (Dictionary<string, object>)ret["ITEMS"]; | |
198 | List<InventoryItemBase> items = new List<InventoryItemBase>(); | 212 | List<InventoryItemBase> fitems = new List<InventoryItemBase>(); |
199 | 213 | foreach (Object o in items.Values) // getting the values directly, we don't care about the keys item_i | |
200 | foreach (Object o in ret.Values) | 214 | fitems.Add(BuildItem((Dictionary<string, object>)o)); |
201 | items.Add(BuildItem((Dictionary<string,object>)o)); | ||
202 | 215 | ||
203 | return items; | 216 | return fitems; |
204 | } | 217 | } |
205 | 218 | ||
206 | public bool AddFolder(InventoryFolderBase folder) | 219 | public bool AddFolder(InventoryFolderBase folder) |
@@ -405,7 +418,7 @@ namespace OpenSim.Services.Connectors | |||
405 | if (ret.Count == 0) | 418 | if (ret.Count == 0) |
406 | return null; | 419 | return null; |
407 | 420 | ||
408 | return BuildItem(ret); | 421 | return BuildItem((Dictionary<string, object>)ret["item"]); |
409 | } | 422 | } |
410 | 423 | ||
411 | public InventoryFolderBase GetFolder(InventoryFolderBase folder) | 424 | public InventoryFolderBase GetFolder(InventoryFolderBase folder) |
@@ -420,7 +433,7 @@ namespace OpenSim.Services.Connectors | |||
420 | if (ret.Count == 0) | 433 | if (ret.Count == 0) |
421 | return null; | 434 | return null; |
422 | 435 | ||
423 | return BuildFolder(ret); | 436 | return BuildFolder((Dictionary<string, object>)ret["folder"]); |
424 | } | 437 | } |
425 | 438 | ||
426 | public List<InventoryItemBase> GetActiveGestures(UUID principalID) | 439 | public List<InventoryItemBase> GetActiveGestures(UUID principalID) |
@@ -435,8 +448,8 @@ namespace OpenSim.Services.Connectors | |||
435 | 448 | ||
436 | List<InventoryItemBase> items = new List<InventoryItemBase>(); | 449 | List<InventoryItemBase> items = new List<InventoryItemBase>(); |
437 | 450 | ||
438 | foreach (Object o in ret.Values) | 451 | foreach (Object o in ret.Values) // getting the values directly, we don't care about the keys item_i |
439 | items.Add(BuildItem((Dictionary<string,object>)o)); | 452 | items.Add(BuildItem((Dictionary<string, object>)o)); |
440 | 453 | ||
441 | return items; | 454 | return items; |
442 | } | 455 | } |
@@ -455,6 +468,36 @@ namespace OpenSim.Services.Connectors | |||
455 | return int.Parse(ret["RESULT"].ToString()); | 468 | return int.Parse(ret["RESULT"].ToString()); |
456 | } | 469 | } |
457 | 470 | ||
471 | public Dictionary<AssetType, InventoryFolderBase> GetSystemFolders(UUID userID) | ||
472 | { | ||
473 | Dictionary<string, object> ret = MakeRequest("GETSYSTEMFOLDERS", | ||
474 | new Dictionary<string, object> { | ||
475 | { "PRINCIPAL", userID.ToString() }, | ||
476 | }); | ||
477 | |||
478 | if (ret == null) | ||
479 | return new Dictionary<AssetType,InventoryFolderBase>(); | ||
480 | |||
481 | Dictionary<AssetType, InventoryFolderBase> sfolders = new Dictionary<AssetType, InventoryFolderBase>(); | ||
482 | |||
483 | try | ||
484 | { | ||
485 | Dictionary<string, object> folders = (Dictionary<string, object>)ret["FOLDERS"]; | ||
486 | |||
487 | foreach (Object o in folders.Values) // getting the values directly, we don't care about the keys folder_i | ||
488 | { | ||
489 | InventoryFolderBase folder = BuildFolder((Dictionary<string, object>)o); | ||
490 | sfolders.Add((AssetType)folder.Type, folder); | ||
491 | } | ||
492 | |||
493 | } | ||
494 | catch (Exception e) | ||
495 | { | ||
496 | m_log.DebugFormat("[XINVENTORY CONNECTOR STUB]: exception {0}", e.Message); | ||
497 | } | ||
498 | |||
499 | return sfolders; | ||
500 | } | ||
458 | 501 | ||
459 | // These are either obsolete or unused | 502 | // These are either obsolete or unused |
460 | // | 503 | // |
@@ -493,13 +536,20 @@ namespace OpenSim.Services.Connectors | |||
493 | { | 536 | { |
494 | InventoryFolderBase folder = new InventoryFolderBase(); | 537 | InventoryFolderBase folder = new InventoryFolderBase(); |
495 | 538 | ||
496 | folder.ParentID = new UUID(data["ParentID"].ToString()); | 539 | try |
497 | folder.Type = short.Parse(data["Type"].ToString()); | 540 | { |
498 | folder.Version = ushort.Parse(data["Version"].ToString()); | 541 | folder.ParentID = new UUID(data["ParentID"].ToString()); |
499 | folder.Name = data["Name"].ToString(); | 542 | folder.Type = short.Parse(data["Type"].ToString()); |
500 | folder.Owner = new UUID(data["Owner"].ToString()); | 543 | folder.Version = ushort.Parse(data["Version"].ToString()); |
501 | folder.ID = new UUID(data["ID"].ToString()); | 544 | folder.Name = data["Name"].ToString(); |
502 | 545 | folder.Owner = new UUID(data["Owner"].ToString()); | |
546 | folder.ID = new UUID(data["ID"].ToString()); | ||
547 | } | ||
548 | catch (Exception e) | ||
549 | { | ||
550 | m_log.DebugFormat("[XINVENTORY CONNECTOR STUB]: Exception building folder: {0}", e.Message); | ||
551 | } | ||
552 | |||
503 | return folder; | 553 | return folder; |
504 | } | 554 | } |
505 | 555 | ||
@@ -507,26 +557,33 @@ namespace OpenSim.Services.Connectors | |||
507 | { | 557 | { |
508 | InventoryItemBase item = new InventoryItemBase(); | 558 | InventoryItemBase item = new InventoryItemBase(); |
509 | 559 | ||
510 | item.AssetID = new UUID(data["AssetID"].ToString()); | 560 | try |
511 | item.AssetType = int.Parse(data["AssetType"].ToString()); | 561 | { |
512 | item.Name = data["Name"].ToString(); | 562 | item.AssetID = new UUID(data["AssetID"].ToString()); |
513 | item.Owner = new UUID(data["Owner"].ToString()); | 563 | item.AssetType = int.Parse(data["AssetType"].ToString()); |
514 | item.ID = new UUID(data["ID"].ToString()); | 564 | item.Name = data["Name"].ToString(); |
515 | item.InvType = int.Parse(data["InvType"].ToString()); | 565 | item.Owner = new UUID(data["Owner"].ToString()); |
516 | item.Folder = new UUID(data["Folder"].ToString()); | 566 | item.ID = new UUID(data["ID"].ToString()); |
517 | item.CreatorId = data["CreatorId"].ToString(); | 567 | item.InvType = int.Parse(data["InvType"].ToString()); |
518 | item.Description = data["Description"].ToString(); | 568 | item.Folder = new UUID(data["Folder"].ToString()); |
519 | item.NextPermissions = uint.Parse(data["NextPermissions"].ToString()); | 569 | item.CreatorId = data["CreatorId"].ToString(); |
520 | item.CurrentPermissions = uint.Parse(data["CurrentPermissions"].ToString()); | 570 | item.Description = data["Description"].ToString(); |
521 | item.BasePermissions = uint.Parse(data["BasePermissions"].ToString()); | 571 | item.NextPermissions = uint.Parse(data["NextPermissions"].ToString()); |
522 | item.EveryOnePermissions = uint.Parse(data["EveryOnePermissions"].ToString()); | 572 | item.CurrentPermissions = uint.Parse(data["CurrentPermissions"].ToString()); |
523 | item.GroupPermissions = uint.Parse(data["GroupPermissions"].ToString()); | 573 | item.BasePermissions = uint.Parse(data["BasePermissions"].ToString()); |
524 | item.GroupID = new UUID(data["GroupID"].ToString()); | 574 | item.EveryOnePermissions = uint.Parse(data["EveryOnePermissions"].ToString()); |
525 | item.GroupOwned = bool.Parse(data["GroupOwned"].ToString()); | 575 | item.GroupPermissions = uint.Parse(data["GroupPermissions"].ToString()); |
526 | item.SalePrice = int.Parse(data["SalePrice"].ToString()); | 576 | item.GroupID = new UUID(data["GroupID"].ToString()); |
527 | item.SaleType = byte.Parse(data["SaleType"].ToString()); | 577 | item.GroupOwned = bool.Parse(data["GroupOwned"].ToString()); |
528 | item.Flags = uint.Parse(data["Flags"].ToString()); | 578 | item.SalePrice = int.Parse(data["SalePrice"].ToString()); |
529 | item.CreationDate = int.Parse(data["CreationDate"].ToString()); | 579 | item.SaleType = byte.Parse(data["SaleType"].ToString()); |
580 | item.Flags = uint.Parse(data["Flags"].ToString()); | ||
581 | item.CreationDate = int.Parse(data["CreationDate"].ToString()); | ||
582 | } | ||
583 | catch (Exception e) | ||
584 | { | ||
585 | m_log.DebugFormat("[XINVENTORY CONNECTOR STUB]: Exception building item: {0}", e.Message); | ||
586 | } | ||
530 | 587 | ||
531 | return item; | 588 | return item; |
532 | } | 589 | } |
diff --git a/OpenSim/Services/Interfaces/ILoginService.cs b/OpenSim/Services/Interfaces/ILoginService.cs index 24bf342..49efbe2 100644 --- a/OpenSim/Services/Interfaces/ILoginService.cs +++ b/OpenSim/Services/Interfaces/ILoginService.cs | |||
@@ -31,6 +31,7 @@ using System.Collections.Generic; | |||
31 | using System.Net; | 31 | using System.Net; |
32 | 32 | ||
33 | using OpenMetaverse.StructuredData; | 33 | using OpenMetaverse.StructuredData; |
34 | using OpenMetaverse; | ||
34 | 35 | ||
35 | namespace OpenSim.Services.Interfaces | 36 | namespace OpenSim.Services.Interfaces |
36 | { | 37 | { |
@@ -46,7 +47,7 @@ namespace OpenSim.Services.Interfaces | |||
46 | 47 | ||
47 | public interface ILoginService | 48 | public interface ILoginService |
48 | { | 49 | { |
49 | LoginResponse Login(string firstName, string lastName, string passwd, string startLocation, IPEndPoint clientIP); | 50 | LoginResponse Login(string firstName, string lastName, string passwd, string startLocation, UUID scopeID, IPEndPoint clientIP); |
50 | } | 51 | } |
51 | 52 | ||
52 | 53 | ||
diff --git a/OpenSim/Services/InventoryService/InventoryService.cs b/OpenSim/Services/InventoryService/InventoryService.cs index 0d6577e..fbcd663 100644 --- a/OpenSim/Services/InventoryService/InventoryService.cs +++ b/OpenSim/Services/InventoryService/InventoryService.cs | |||
@@ -109,7 +109,7 @@ namespace OpenSim.Services.InventoryService | |||
109 | { | 109 | { |
110 | existingRootFolder = GetRootFolder(user); | 110 | existingRootFolder = GetRootFolder(user); |
111 | } | 111 | } |
112 | catch (Exception e) | 112 | catch /*(Exception e)*/ |
113 | { | 113 | { |
114 | // Munch the exception, it has already been reported | 114 | // Munch the exception, it has already been reported |
115 | // | 115 | // |
diff --git a/OpenSim/Services/InventoryService/XInventoryService.cs b/OpenSim/Services/InventoryService/XInventoryService.cs index bbd37d1..4d7103b 100644 --- a/OpenSim/Services/InventoryService/XInventoryService.cs +++ b/OpenSim/Services/InventoryService/XInventoryService.cs | |||
@@ -184,7 +184,7 @@ namespace OpenSim.Services.InventoryService | |||
184 | 184 | ||
185 | foreach (XInventoryFolder x in allFolders) | 185 | foreach (XInventoryFolder x in allFolders) |
186 | { | 186 | { |
187 | m_log.DebugFormat("[INVENTORY]: Adding folder {0} to skeleton", x.folderName); | 187 | //m_log.DebugFormat("[XINVENTORY]: Adding folder {0} to skeleton", x.folderName); |
188 | folders.Add(ConvertToOpenSim(x)); | 188 | folders.Add(ConvertToOpenSim(x)); |
189 | } | 189 | } |
190 | 190 | ||
@@ -221,7 +221,7 @@ namespace OpenSim.Services.InventoryService | |||
221 | // connector. So we disregard the principal and look | 221 | // connector. So we disregard the principal and look |
222 | // by ID. | 222 | // by ID. |
223 | // | 223 | // |
224 | m_log.DebugFormat("[INVENTORY]: Fetch contents for folder {0}", folderID.ToString()); | 224 | m_log.DebugFormat("[XINVENTORY]: Fetch contents for folder {0}", folderID.ToString()); |
225 | InventoryCollection inventory = new InventoryCollection(); | 225 | InventoryCollection inventory = new InventoryCollection(); |
226 | inventory.UserID = principalID; | 226 | inventory.UserID = principalID; |
227 | inventory.Folders = new List<InventoryFolderBase>(); | 227 | inventory.Folders = new List<InventoryFolderBase>(); |
@@ -233,7 +233,7 @@ namespace OpenSim.Services.InventoryService | |||
233 | 233 | ||
234 | foreach (XInventoryFolder x in folders) | 234 | foreach (XInventoryFolder x in folders) |
235 | { | 235 | { |
236 | m_log.DebugFormat("[INVENTORY]: Adding folder {0} to response", x.folderName); | 236 | //m_log.DebugFormat("[XINVENTORY]: Adding folder {0} to response", x.folderName); |
237 | inventory.Folders.Add(ConvertToOpenSim(x)); | 237 | inventory.Folders.Add(ConvertToOpenSim(x)); |
238 | } | 238 | } |
239 | 239 | ||
@@ -243,7 +243,7 @@ namespace OpenSim.Services.InventoryService | |||
243 | 243 | ||
244 | foreach (XInventoryItem i in items) | 244 | foreach (XInventoryItem i in items) |
245 | { | 245 | { |
246 | m_log.DebugFormat("[INVENTORY]: Adding item {0} to response", i.inventoryName); | 246 | //m_log.DebugFormat("[XINVENTORY]: Adding item {0} to response", i.inventoryName); |
247 | inventory.Items.Add(ConvertToOpenSim(i)); | 247 | inventory.Items.Add(ConvertToOpenSim(i)); |
248 | } | 248 | } |
249 | 249 | ||
diff --git a/OpenSim/Services/LLLoginService/LLLoginService.cs b/OpenSim/Services/LLLoginService/LLLoginService.cs index c333b5c..4d7dfd1 100644 --- a/OpenSim/Services/LLLoginService/LLLoginService.cs +++ b/OpenSim/Services/LLLoginService/LLLoginService.cs | |||
@@ -147,7 +147,7 @@ namespace OpenSim.Services.LLLoginService | |||
147 | { | 147 | { |
148 | } | 148 | } |
149 | 149 | ||
150 | public LoginResponse Login(string firstName, string lastName, string passwd, string startLocation, IPEndPoint clientIP) | 150 | public LoginResponse Login(string firstName, string lastName, string passwd, string startLocation, UUID scopeID, IPEndPoint clientIP) |
151 | { | 151 | { |
152 | bool success = false; | 152 | bool success = false; |
153 | UUID session = UUID.Random(); | 153 | UUID session = UUID.Random(); |
@@ -157,7 +157,7 @@ namespace OpenSim.Services.LLLoginService | |||
157 | // | 157 | // |
158 | // Get the account and check that it exists | 158 | // Get the account and check that it exists |
159 | // | 159 | // |
160 | UserAccount account = m_UserAccountService.GetUserAccount(UUID.Zero, firstName, lastName); | 160 | UserAccount account = m_UserAccountService.GetUserAccount(scopeID, firstName, lastName); |
161 | if (account == null) | 161 | if (account == null) |
162 | { | 162 | { |
163 | m_log.InfoFormat("[LLOGIN SERVICE]: Login failed, reason: user not found"); | 163 | m_log.InfoFormat("[LLOGIN SERVICE]: Login failed, reason: user not found"); |
@@ -170,6 +170,22 @@ namespace OpenSim.Services.LLLoginService | |||
170 | return LLFailedLoginResponse.LoginBlockedProblem; | 170 | return LLFailedLoginResponse.LoginBlockedProblem; |
171 | } | 171 | } |
172 | 172 | ||
173 | // If a scope id is requested, check that the account is in | ||
174 | // that scope, or unscoped. | ||
175 | // | ||
176 | if (scopeID != UUID.Zero) | ||
177 | { | ||
178 | if (account.ScopeID != scopeID && account.ScopeID != UUID.Zero) | ||
179 | { | ||
180 | m_log.InfoFormat("[LLOGIN SERVICE]: Login failed, reason: user not found"); | ||
181 | return LLFailedLoginResponse.UserProblem; | ||
182 | } | ||
183 | } | ||
184 | else | ||
185 | { | ||
186 | scopeID = account.ScopeID; | ||
187 | } | ||
188 | |||
173 | // | 189 | // |
174 | // Authenticate this user | 190 | // Authenticate this user |
175 | // | 191 | // |
@@ -219,7 +235,7 @@ namespace OpenSim.Services.LLLoginService | |||
219 | // Get the home region | 235 | // Get the home region |
220 | if ((presence.HomeRegionID != UUID.Zero) && m_GridService != null) | 236 | if ((presence.HomeRegionID != UUID.Zero) && m_GridService != null) |
221 | { | 237 | { |
222 | home = m_GridService.GetRegionByUUID(account.ScopeID, presence.HomeRegionID); | 238 | home = m_GridService.GetRegionByUUID(scopeID, presence.HomeRegionID); |
223 | } | 239 | } |
224 | } | 240 | } |
225 | 241 | ||
@@ -230,7 +246,7 @@ namespace OpenSim.Services.LLLoginService | |||
230 | Vector3 position = Vector3.Zero; | 246 | Vector3 position = Vector3.Zero; |
231 | Vector3 lookAt = Vector3.Zero; | 247 | Vector3 lookAt = Vector3.Zero; |
232 | GridRegion gatekeeper = null; | 248 | GridRegion gatekeeper = null; |
233 | GridRegion destination = FindDestination(account, presence, session, startLocation, out gatekeeper, out where, out position, out lookAt); | 249 | GridRegion destination = FindDestination(account, scopeID, presence, session, startLocation, out gatekeeper, out where, out position, out lookAt); |
234 | if (destination == null) | 250 | if (destination == null) |
235 | { | 251 | { |
236 | m_PresenceService.LogoutAgent(session, presence.Position, presence.LookAt); | 252 | m_PresenceService.LogoutAgent(session, presence.Position, presence.LookAt); |
@@ -286,7 +302,7 @@ namespace OpenSim.Services.LLLoginService | |||
286 | } | 302 | } |
287 | } | 303 | } |
288 | 304 | ||
289 | protected GridRegion FindDestination(UserAccount account, PresenceInfo pinfo, UUID sessionID, string startLocation, out GridRegion gatekeeper, out string where, out Vector3 position, out Vector3 lookAt) | 305 | protected GridRegion FindDestination(UserAccount account, UUID scopeID, PresenceInfo pinfo, UUID sessionID, string startLocation, out GridRegion gatekeeper, out string where, out Vector3 position, out Vector3 lookAt) |
290 | { | 306 | { |
291 | m_log.DebugFormat("[LLOGIN SERVICE]: FindDestination for start location {0}", startLocation); | 307 | m_log.DebugFormat("[LLOGIN SERVICE]: FindDestination for start location {0}", startLocation); |
292 | 308 | ||
@@ -318,7 +334,7 @@ namespace OpenSim.Services.LLLoginService | |||
318 | } | 334 | } |
319 | else | 335 | else |
320 | { | 336 | { |
321 | region = m_GridService.GetRegionByUUID(account.ScopeID, pinfo.HomeRegionID); | 337 | region = m_GridService.GetRegionByUUID(scopeID, pinfo.HomeRegionID); |
322 | 338 | ||
323 | if (null == region) | 339 | if (null == region) |
324 | { | 340 | { |
@@ -332,7 +348,7 @@ namespace OpenSim.Services.LLLoginService | |||
332 | 348 | ||
333 | if (tryDefaults) | 349 | if (tryDefaults) |
334 | { | 350 | { |
335 | List<GridRegion> defaults = m_GridService.GetDefaultRegions(account.ScopeID); | 351 | List<GridRegion> defaults = m_GridService.GetDefaultRegions(scopeID); |
336 | if (defaults != null && defaults.Count > 0) | 352 | if (defaults != null && defaults.Count > 0) |
337 | { | 353 | { |
338 | region = defaults[0]; | 354 | region = defaults[0]; |
@@ -342,7 +358,7 @@ namespace OpenSim.Services.LLLoginService | |||
342 | { | 358 | { |
343 | m_log.WarnFormat("[LLOGIN SERVICE]: User {0} {1} does not have a valid home and this grid does not have default locations. Attempting to find random region", | 359 | m_log.WarnFormat("[LLOGIN SERVICE]: User {0} {1} does not have a valid home and this grid does not have default locations. Attempting to find random region", |
344 | account.FirstName, account.LastName); | 360 | account.FirstName, account.LastName); |
345 | defaults = m_GridService.GetRegionsByName(account.ScopeID, "", 1); | 361 | defaults = m_GridService.GetRegionsByName(scopeID, "", 1); |
346 | if (defaults != null && defaults.Count > 0) | 362 | if (defaults != null && defaults.Count > 0) |
347 | { | 363 | { |
348 | region = defaults[0]; | 364 | region = defaults[0]; |
@@ -363,9 +379,9 @@ namespace OpenSim.Services.LLLoginService | |||
363 | 379 | ||
364 | GridRegion region = null; | 380 | GridRegion region = null; |
365 | 381 | ||
366 | if (pinfo.RegionID.Equals(UUID.Zero) || (region = m_GridService.GetRegionByUUID(account.ScopeID, pinfo.RegionID)) == null) | 382 | if (pinfo.RegionID.Equals(UUID.Zero) || (region = m_GridService.GetRegionByUUID(scopeID, pinfo.RegionID)) == null) |
367 | { | 383 | { |
368 | List<GridRegion> defaults = m_GridService.GetDefaultRegions(account.ScopeID); | 384 | List<GridRegion> defaults = m_GridService.GetDefaultRegions(scopeID); |
369 | if (defaults != null && defaults.Count > 0) | 385 | if (defaults != null && defaults.Count > 0) |
370 | { | 386 | { |
371 | region = defaults[0]; | 387 | region = defaults[0]; |
@@ -374,7 +390,7 @@ namespace OpenSim.Services.LLLoginService | |||
374 | else | 390 | else |
375 | { | 391 | { |
376 | m_log.Info("[LLOGIN SERVICE]: Last Region Not Found Attempting to find random region"); | 392 | m_log.Info("[LLOGIN SERVICE]: Last Region Not Found Attempting to find random region"); |
377 | defaults = m_GridService.GetRegionsByName(account.ScopeID, "", 1); | 393 | defaults = m_GridService.GetRegionsByName(scopeID, "", 1); |
378 | if (defaults != null && defaults.Count > 0) | 394 | if (defaults != null && defaults.Count > 0) |
379 | { | 395 | { |
380 | region = defaults[0]; | 396 | region = defaults[0]; |
@@ -414,11 +430,11 @@ namespace OpenSim.Services.LLLoginService | |||
414 | { | 430 | { |
415 | if (!regionName.Contains("@")) | 431 | if (!regionName.Contains("@")) |
416 | { | 432 | { |
417 | List<GridRegion> regions = m_GridService.GetRegionsByName(account.ScopeID, regionName, 1); | 433 | List<GridRegion> regions = m_GridService.GetRegionsByName(scopeID, regionName, 1); |
418 | if ((regions == null) || (regions != null && regions.Count == 0)) | 434 | if ((regions == null) || (regions != null && regions.Count == 0)) |
419 | { | 435 | { |
420 | m_log.InfoFormat("[LLLOGIN SERVICE]: Got Custom Login URI {0}, can't locate region {1}. Trying defaults.", startLocation, regionName); | 436 | m_log.InfoFormat("[LLLOGIN SERVICE]: Got Custom Login URI {0}, can't locate region {1}. Trying defaults.", startLocation, regionName); |
421 | regions = m_GridService.GetDefaultRegions(UUID.Zero); | 437 | regions = m_GridService.GetDefaultRegions(scopeID); |
422 | if (regions != null && regions.Count > 0) | 438 | if (regions != null && regions.Count > 0) |
423 | { | 439 | { |
424 | where = "safe"; | 440 | where = "safe"; |
@@ -461,7 +477,7 @@ namespace OpenSim.Services.LLLoginService | |||
461 | } | 477 | } |
462 | else | 478 | else |
463 | { | 479 | { |
464 | List<GridRegion> defaults = m_GridService.GetDefaultRegions(account.ScopeID); | 480 | List<GridRegion> defaults = m_GridService.GetDefaultRegions(scopeID); |
465 | if (defaults != null && defaults.Count > 0) | 481 | if (defaults != null && defaults.Count > 0) |
466 | { | 482 | { |
467 | where = "safe"; | 483 | where = "safe"; |