diff options
author | lbsa71 | 2007-09-27 14:57:43 +0000 |
---|---|---|
committer | lbsa71 | 2007-09-27 14:57:43 +0000 |
commit | 863195612bdef56165f2b4354bab280c371618b9 (patch) | |
tree | 63cec15a6c0338a8777640ed13fd7c3ce05eeba7 /OpenSim/Framework/Communications | |
parent | revert change to libsecondlife.dll.config which breaks Linux (diff) | |
download | opensim-SC_OLD-863195612bdef56165f2b4354bab280c371618b9.zip opensim-SC_OLD-863195612bdef56165f2b4354bab280c371618b9.tar.gz opensim-SC_OLD-863195612bdef56165f2b4354bab280c371618b9.tar.bz2 opensim-SC_OLD-863195612bdef56165f2b4354bab280c371618b9.tar.xz |
Reverting back to 2017 since 2018 were causing Linux breakage; reopening Tleiades patch 444 and 445.
Diffstat (limited to 'OpenSim/Framework/Communications')
8 files changed, 165 insertions, 347 deletions
diff --git a/OpenSim/Framework/Communications/CAPSService.cs b/OpenSim/Framework/Communications/CAPSService.cs index 40d8d37..a8eac26 100644 --- a/OpenSim/Framework/Communications/CAPSService.cs +++ b/OpenSim/Framework/Communications/CAPSService.cs | |||
@@ -8,6 +8,7 @@ using Nwc.XmlRpc; | |||
8 | using OpenSim.Framework.Console; | 8 | using OpenSim.Framework.Console; |
9 | using OpenSim.Framework.Data; | 9 | using OpenSim.Framework.Data; |
10 | using OpenSim.Framework.Interfaces; | 10 | using OpenSim.Framework.Interfaces; |
11 | using OpenSim.Framework.Inventory; | ||
11 | using OpenSim.Framework.Utilities; | 12 | using OpenSim.Framework.Utilities; |
12 | using OpenSim.Framework.Servers; | 13 | using OpenSim.Framework.Servers; |
13 | 14 | ||
diff --git a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs index 9e8c239..99dc45a 100644 --- a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs +++ b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs | |||
@@ -38,7 +38,7 @@ using OpenSim.Framework.Utilities; | |||
38 | 38 | ||
39 | namespace OpenSim.Framework.Communications.Caches | 39 | namespace OpenSim.Framework.Communications.Caches |
40 | { | 40 | { |
41 | public class CachedUserInfo : MarshalByRefObject | 41 | public class CachedUserInfo |
42 | { | 42 | { |
43 | private CommunicationsManager m_parentCommsManager; | 43 | private CommunicationsManager m_parentCommsManager; |
44 | // Fields | 44 | // Fields |
@@ -51,7 +51,7 @@ namespace OpenSim.Framework.Communications.Caches | |||
51 | } | 51 | } |
52 | 52 | ||
53 | // Methods | 53 | // Methods |
54 | public void FolderReceive(LLUUID userID, InventoryFolderBase folderInfo) | 54 | public void FolderReceive(LLUUID userID, InventoryFolder folderInfo) |
55 | { | 55 | { |
56 | if (userID == this.UserProfile.UUID) | 56 | if (userID == this.UserProfile.UUID) |
57 | { | 57 | { |
@@ -59,19 +59,19 @@ namespace OpenSim.Framework.Communications.Caches | |||
59 | { | 59 | { |
60 | if (folderInfo.parentID == LLUUID.Zero) | 60 | if (folderInfo.parentID == LLUUID.Zero) |
61 | { | 61 | { |
62 | this.RootFolder = new InventoryFolder(folderInfo); | 62 | this.RootFolder = folderInfo; |
63 | } | 63 | } |
64 | } | 64 | } |
65 | else if (this.RootFolder.folderID == folderInfo.parentID) | 65 | else if (this.RootFolder.folderID == folderInfo.parentID) |
66 | { | 66 | { |
67 | this.RootFolder.SubFolders.Add(folderInfo.folderID, new InventoryFolder(folderInfo)); | 67 | this.RootFolder.SubFolders.Add(folderInfo.folderID, folderInfo); |
68 | } | 68 | } |
69 | else | 69 | else |
70 | { | 70 | { |
71 | InventoryFolder folder = this.RootFolder.HasSubFolder(folderInfo.parentID); | 71 | InventoryFolder folder = this.RootFolder.HasSubFolder(folderInfo.parentID); |
72 | if (folder != null) | 72 | if (folder != null) |
73 | { | 73 | { |
74 | folder.SubFolders.Add(folderInfo.folderID, new InventoryFolder(folderInfo)); | 74 | folder.SubFolders.Add(folderInfo.folderID, folderInfo); |
75 | } | 75 | } |
76 | } | 76 | } |
77 | } | 77 | } |
@@ -131,7 +131,3 @@ namespace OpenSim.Framework.Communications.Caches | |||
131 | 131 | ||
132 | } | 132 | } |
133 | 133 | ||
134 | |||
135 | |||
136 | |||
137 | |||
diff --git a/OpenSim/Framework/Communications/Cache/InventoryFolder.cs b/OpenSim/Framework/Communications/Cache/InventoryFolder.cs index a212614..885cffc 100644 --- a/OpenSim/Framework/Communications/Cache/InventoryFolder.cs +++ b/OpenSim/Framework/Communications/Cache/InventoryFolder.cs | |||
@@ -35,9 +35,6 @@ using OpenSim.Framework.Interfaces; | |||
35 | using OpenSim.Framework.Data; | 35 | using OpenSim.Framework.Data; |
36 | using OpenSim.Framework.Types; | 36 | using OpenSim.Framework.Types; |
37 | using OpenSim.Framework.Utilities; | 37 | using OpenSim.Framework.Utilities; |
38 | using OpenSim.Framework.Console; | ||
39 | |||
40 | using InventoryCategory = OpenSim.Framework.Data.InventoryCategory; | ||
41 | 38 | ||
42 | namespace OpenSim.Framework.Communications.Caches | 39 | namespace OpenSim.Framework.Communications.Caches |
43 | { | 40 | { |
@@ -63,7 +60,7 @@ namespace OpenSim.Framework.Communications.Caches | |||
63 | } | 60 | } |
64 | 61 | ||
65 | // Methods | 62 | // Methods |
66 | public InventoryFolder CreateNewSubFolder(LLUUID folderID, string folderName, ushort type, InventoryCategory category) | 63 | public InventoryFolder CreateNewSubFolder(LLUUID folderID, string folderName, ushort type) |
67 | { | 64 | { |
68 | InventoryFolder subFold = new InventoryFolder(); | 65 | InventoryFolder subFold = new InventoryFolder(); |
69 | subFold.name = folderName; | 66 | subFold.name = folderName; |
@@ -71,12 +68,7 @@ namespace OpenSim.Framework.Communications.Caches | |||
71 | subFold.type = (short) type; | 68 | subFold.type = (short) type; |
72 | subFold.parentID = this.folderID; | 69 | subFold.parentID = this.folderID; |
73 | subFold.agentID = this.agentID; | 70 | subFold.agentID = this.agentID; |
74 | subFold.category = category; | 71 | this.SubFolders.Add(subFold.folderID, subFold); |
75 | if (!SubFolders.ContainsKey(subFold.folderID)) | ||
76 | this.SubFolders.Add(subFold.folderID, subFold); | ||
77 | else | ||
78 | MainLog.Instance.Warn("INVENTORYCACHE", "Attempt to create a duplicate folder {0} {1}", folderName, folderID); | ||
79 | |||
80 | return subFold; | 72 | return subFold; |
81 | } | 73 | } |
82 | 74 | ||
diff --git a/OpenSim/Framework/Communications/Cache/UserProfileCache.cs b/OpenSim/Framework/Communications/Cache/UserProfileCache.cs index 3dadf9c..390b938 100644 --- a/OpenSim/Framework/Communications/Cache/UserProfileCache.cs +++ b/OpenSim/Framework/Communications/Cache/UserProfileCache.cs | |||
@@ -35,11 +35,10 @@ using OpenSim.Framework.Interfaces; | |||
35 | using OpenSim.Framework.Types; | 35 | using OpenSim.Framework.Types; |
36 | using OpenSim.Framework.Utilities; | 36 | using OpenSim.Framework.Utilities; |
37 | using OpenSim.Framework.Data; | 37 | using OpenSim.Framework.Data; |
38 | using InventoryCategory = OpenSim.Framework.Data.InventoryCategory; | ||
39 | 38 | ||
40 | namespace OpenSim.Framework.Communications.Caches | 39 | namespace OpenSim.Framework.Communications.Caches |
41 | { | 40 | { |
42 | public class UserProfileCache : MarshalByRefObject | 41 | public class UserProfileCache |
43 | { | 42 | { |
44 | // Fields | 43 | // Fields |
45 | private CommunicationsManager m_parent; | 44 | private CommunicationsManager m_parent; |
@@ -104,7 +103,7 @@ namespace OpenSim.Framework.Communications.Caches | |||
104 | CachedUserInfo info = this.UserProfiles[remoteClient.AgentId]; | 103 | CachedUserInfo info = this.UserProfiles[remoteClient.AgentId]; |
105 | if (info.RootFolder.folderID == parentID) | 104 | if (info.RootFolder.folderID == parentID) |
106 | { | 105 | { |
107 | InventoryFolder createdFolder = info.RootFolder.CreateNewSubFolder(folderID, folderName, folderType, InventoryCategory.User); | 106 | InventoryFolder createdFolder = info.RootFolder.CreateNewSubFolder(folderID, folderName, folderType); |
108 | if (createdFolder != null) | 107 | if (createdFolder != null) |
109 | { | 108 | { |
110 | this.m_parent.InventoryService.AddNewInventoryFolder(remoteClient.AgentId, createdFolder); | 109 | this.m_parent.InventoryService.AddNewInventoryFolder(remoteClient.AgentId, createdFolder); |
@@ -115,7 +114,7 @@ namespace OpenSim.Framework.Communications.Caches | |||
115 | InventoryFolder folder = info.RootFolder.HasSubFolder(parentID); | 114 | InventoryFolder folder = info.RootFolder.HasSubFolder(parentID); |
116 | if (folder != null) | 115 | if (folder != null) |
117 | { | 116 | { |
118 | folder.CreateNewSubFolder(folderID, folderName, folderType, InventoryCategory.User); | 117 | folder.CreateNewSubFolder(folderID, folderName, folderType); |
119 | } | 118 | } |
120 | } | 119 | } |
121 | } | 120 | } |
@@ -125,21 +124,16 @@ namespace OpenSim.Framework.Communications.Caches | |||
125 | public void HandleFecthInventoryDescendents(IClientAPI remoteClient, LLUUID folderID, LLUUID ownerID, bool fetchFolders, bool fetchItems, int sortOrder) | 124 | public void HandleFecthInventoryDescendents(IClientAPI remoteClient, LLUUID folderID, LLUUID ownerID, bool fetchFolders, bool fetchItems, int sortOrder) |
126 | { | 125 | { |
127 | InventoryFolder fold = null; | 126 | InventoryFolder fold = null; |
128 | |||
129 | if (folderID == libraryRoot.folderID ) | 127 | if (folderID == libraryRoot.folderID ) |
130 | { | 128 | { |
131 | // we are looking for the root of the shared inventory | ||
132 | remoteClient.SendInventoryFolderDetails(libraryRoot.agentID, libraryRoot.folderID, libraryRoot.RequestListOfItems()); | 129 | remoteClient.SendInventoryFolderDetails(libraryRoot.agentID, libraryRoot.folderID, libraryRoot.RequestListOfItems()); |
133 | } | 130 | } |
134 | else if (( fold = libraryRoot.HasSubFolder(folderID)) != null) | 131 | else if (( fold = libraryRoot.HasSubFolder(folderID)) != null) |
135 | { | 132 | { |
136 | // we are looking for a sub folder of the shared inventory | ||
137 | remoteClient.SendInventoryFolderDetails(libraryRoot.agentID, folderID, fold.RequestListOfItems()); | 133 | remoteClient.SendInventoryFolderDetails(libraryRoot.agentID, folderID, fold.RequestListOfItems()); |
138 | } | 134 | } |
139 | else if (this.UserProfiles.ContainsKey(remoteClient.AgentId)) | 135 | else if (this.UserProfiles.ContainsKey(remoteClient.AgentId)) |
140 | { | 136 | { |
141 | //if we get here, we are looking the inventory of an agent in this sim | ||
142 | //now we need to see if we already have the inventory cached | ||
143 | if (this.UserProfiles[remoteClient.AgentId].RootFolder != null) | 137 | if (this.UserProfiles[remoteClient.AgentId].RootFolder != null) |
144 | { | 138 | { |
145 | CachedUserInfo info = this.UserProfiles[remoteClient.AgentId]; | 139 | CachedUserInfo info = this.UserProfiles[remoteClient.AgentId]; |
@@ -159,23 +153,9 @@ namespace OpenSim.Framework.Communications.Caches | |||
159 | } | 153 | } |
160 | } | 154 | } |
161 | } | 155 | } |
162 | else | ||
163 | { | ||
164 | //nope, inventory wasn't cached, so go to the inventory server and ask for the inventory | ||
165 | m_parent.InventoryService.RequestInventoryForUser(remoteClient.AgentId, ReceiveFolderInfo, ReceiveItemInfo); | ||
166 | } | ||
167 | } | 156 | } |
168 | } | 157 | } |
169 | 158 | ||
170 | public void ReceiveFolderInfo(LLUUID userID, InventoryFolderBase folderInfo) | ||
171 | { | ||
172 | } | ||
173 | |||
174 | public void ReceiveItemInfo(LLUUID userID, InventoryItemBase itemInfo) | ||
175 | { | ||
176 | } | ||
177 | |||
178 | |||
179 | public void HandleFetchInventory(IClientAPI remoteClient, LLUUID itemID, LLUUID ownerID) | 159 | public void HandleFetchInventory(IClientAPI remoteClient, LLUUID itemID, LLUUID ownerID) |
180 | { | 160 | { |
181 | if (ownerID == libraryRoot.agentID) | 161 | if (ownerID == libraryRoot.agentID) |
@@ -201,7 +181,7 @@ namespace OpenSim.Framework.Communications.Caches | |||
201 | /// <param name="userID"></param> | 181 | /// <param name="userID"></param> |
202 | private void RequestInventoryForUser(LLUUID userID, CachedUserInfo userInfo) | 182 | private void RequestInventoryForUser(LLUUID userID, CachedUserInfo userInfo) |
203 | { | 183 | { |
204 | this.m_parent.InventoryService.RequestInventoryForUser(userID, userInfo.FolderReceive, userInfo.ItemReceive); | 184 | this.m_parent.InventoryService.RequestInventoryForUser(userID, userInfo.FolderReceive, userInfo.ItemReceive); |
205 | } | 185 | } |
206 | 186 | ||
207 | /// <summary> | 187 | /// <summary> |
@@ -241,7 +221,3 @@ namespace OpenSim.Framework.Communications.Caches | |||
241 | } | 221 | } |
242 | } | 222 | } |
243 | 223 | ||
244 | |||
245 | |||
246 | |||
247 | |||
diff --git a/OpenSim/Framework/Communications/IInventoryServices.cs b/OpenSim/Framework/Communications/IInventoryServices.cs index 7b2948f..80c2e64 100644 --- a/OpenSim/Framework/Communications/IInventoryServices.cs +++ b/OpenSim/Framework/Communications/IInventoryServices.cs | |||
@@ -1,31 +1,29 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Text; | ||
3 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
4 | 3 | using System.Text; | |
5 | using libsecondlife; | ||
6 | using OpenSim.Framework.Data; | 4 | using OpenSim.Framework.Data; |
5 | using libsecondlife; | ||
7 | using OpenSim.Framework.Communications.Caches; | 6 | using OpenSim.Framework.Communications.Caches; |
7 | using InventoryFolder = OpenSim.Framework.Communications.Caches.InventoryFolder; | ||
8 | 8 | ||
9 | namespace OpenSim.Framework.Communications | 9 | namespace OpenSim.Framework.Communications |
10 | { | 10 | { |
11 | public delegate void InventoryFolderInfo(LLUUID userID, InventoryFolderBase folderInfo); | 11 | public delegate void InventoryFolderInfo(LLUUID userID, InventoryFolder folderInfo); |
12 | public delegate void InventoryItemInfo(LLUUID userID, InventoryItemBase itemInfo); | 12 | public delegate void InventoryItemInfo(LLUUID userID, InventoryItemBase itemInfo); |
13 | 13 | ||
14 | public interface IInventoryServices | 14 | public interface IInventoryServices |
15 | { | 15 | { |
16 | void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack, InventoryItemInfo itemCallBack); | 16 | void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack, InventoryItemInfo itemCallBack); |
17 | void AddNewInventoryFolder(LLUUID userID, InventoryFolderBase folder); | 17 | void AddNewInventoryFolder(LLUUID userID, InventoryFolder folder); |
18 | void AddNewInventoryItem(LLUUID userID, InventoryItemBase item); | 18 | void AddNewInventoryItem(LLUUID userID, InventoryItemBase item); |
19 | void DeleteInventoryItem(LLUUID userID, InventoryItemBase item); | 19 | void DeleteInventoryItem(LLUUID userID, InventoryItemBase item); |
20 | void CreateNewUserInventory(LLUUID libraryRootId, LLUUID user); | 20 | void CreateNewUserInventory(LLUUID user); |
21 | void GetRootFoldersForUser(LLUUID user, out LLUUID libraryFolder, out LLUUID personalFolder); | ||
22 | 21 | ||
23 | /// <summary> | 22 | /// <summary> |
24 | /// Returns the root folder plus any folders in root (so down one level in the Inventory folders tree) | 23 | /// Returns the root folder plus any folders in root (so down one level in the Inventory folders tree) |
25 | /// </summary> | 24 | /// </summary> |
26 | /// <param name="userID"></param> | 25 | /// <param name="userID"></param> |
27 | /// <returns></returns> | 26 | /// <returns></returns> |
28 | List<InventoryFolderBase> RequestFirstLevelFolders(LLUUID folderID); | 27 | List<InventoryFolderBase> RequestFirstLevelFolders(LLUUID userID); |
29 | List<InventoryItemBase> RequestFolderItems(LLUUID folderID); | ||
30 | } | 28 | } |
31 | } | 29 | } |
diff --git a/OpenSim/Framework/Communications/InventoryServiceBase.cs b/OpenSim/Framework/Communications/InventoryServiceBase.cs index 6283b60..da7a0ce 100644 --- a/OpenSim/Framework/Communications/InventoryServiceBase.cs +++ b/OpenSim/Framework/Communications/InventoryServiceBase.cs | |||
@@ -1,9 +1,4 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Text; | ||
3 | using System.IO; | ||
4 | using System.Xml; | ||
5 | using System.Xml.Serialization; | ||
6 | using System.Collections; | ||
7 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
8 | using System.Reflection; | 3 | using System.Reflection; |
9 | using libsecondlife; | 4 | using libsecondlife; |
@@ -11,20 +6,21 @@ using OpenSim.Framework.Communications; | |||
11 | using OpenSim.Framework.Console; | 6 | using OpenSim.Framework.Console; |
12 | using OpenSim.Framework.Data; | 7 | using OpenSim.Framework.Data; |
13 | using InventoryFolder=OpenSim.Framework.Communications.Caches.InventoryFolder; | 8 | using InventoryFolder=OpenSim.Framework.Communications.Caches.InventoryFolder; |
14 | using InventoryCategory = OpenSim.Framework.Data.InventoryCategory; | ||
15 | 9 | ||
16 | namespace OpenSim.Framework.Communications | 10 | namespace OpenSim.Framework.Communications |
17 | { | 11 | { |
18 | public abstract class InventoryServiceBase : MarshalByRefObject, IInventoryServices | 12 | public abstract class InventoryServiceBase : IInventoryServices |
19 | { | 13 | { |
20 | protected IInventoryData _databasePlugin; | 14 | protected Dictionary<string, IInventoryData> m_plugins = new Dictionary<string, IInventoryData>(); |
15 | //protected IAssetServer m_assetServer; | ||
21 | 16 | ||
22 | public InventoryServiceBase() | 17 | public InventoryServiceBase() |
23 | { | 18 | { |
19 | //m_assetServer = assetServer; | ||
24 | } | 20 | } |
25 | 21 | ||
26 | /// <summary> | 22 | /// <summary> |
27 | /// Adds a new inventory data server plugin | 23 | /// Adds a new user server plugin - plugins will be requested in the order they were loaded. |
28 | /// </summary> | 24 | /// </summary> |
29 | /// <param name="FileName">The filename to the user server plugin DLL</param> | 25 | /// <param name="FileName">The filename to the user server plugin DLL</param> |
30 | public void AddPlugin(string FileName) | 26 | public void AddPlugin(string FileName) |
@@ -45,13 +41,8 @@ namespace OpenSim.Framework.Communications | |||
45 | IInventoryData plug = | 41 | IInventoryData plug = |
46 | (IInventoryData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); | 42 | (IInventoryData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); |
47 | plug.Initialise(); | 43 | plug.Initialise(); |
48 | this._databasePlugin = plug; | 44 | this.m_plugins.Add(plug.getName(), plug); |
49 | |||
50 | //TODO! find a better place to create inventory skeletons | ||
51 | loadInventoryFromXmlFile(InventoryCategory.Library, "Inventory_Library.xml"); | ||
52 | loadInventoryFromXmlFile(InventoryCategory.Default, "Inventory_Default.xml"); | ||
53 | MainLog.Instance.Verbose("Inventorystorage: Added IInventoryData Interface"); | 45 | MainLog.Instance.Verbose("Inventorystorage: Added IInventoryData Interface"); |
54 | break; | ||
55 | } | 46 | } |
56 | } | 47 | } |
57 | } | 48 | } |
@@ -63,20 +54,20 @@ namespace OpenSim.Framework.Communications | |||
63 | /// </summary> | 54 | /// </summary> |
64 | /// <param name="userID"></param> | 55 | /// <param name="userID"></param> |
65 | /// <returns></returns> | 56 | /// <returns></returns> |
66 | public List<InventoryFolderBase> RequestFirstLevelFolders(LLUUID folderID) | 57 | public List<InventoryFolderBase> RequestFirstLevelFolders(LLUUID userID) |
67 | { | 58 | { |
68 | InventoryFolderBase root = _databasePlugin.getInventoryFolder(folderID); | 59 | List<InventoryFolderBase> inventoryList = new List<InventoryFolderBase>(); |
69 | 60 | foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins) | |
70 | List<InventoryFolderBase> folders = new List<InventoryFolderBase>(); | ||
71 | if (root != null) | ||
72 | { | 61 | { |
73 | folders.Add(root); | 62 | InventoryFolderBase rootFolder = plugin.Value.getUserRootFolder(userID); |
74 | 63 | if (rootFolder != null) | |
75 | List<InventoryFolderBase> subFolders = _databasePlugin.getInventoryFolders(root.folderID); | 64 | { |
76 | foreach (InventoryFolderBase f in subFolders) | 65 | inventoryList = plugin.Value.getInventoryFolders(rootFolder.folderID); |
77 | folders.Add(f); | 66 | inventoryList.Insert(0, rootFolder); |
67 | return inventoryList; | ||
68 | } | ||
78 | } | 69 | } |
79 | return folders; | 70 | return inventoryList; |
80 | } | 71 | } |
81 | 72 | ||
82 | /// <summary> | 73 | /// <summary> |
@@ -84,7 +75,11 @@ namespace OpenSim.Framework.Communications | |||
84 | /// </summary> | 75 | /// </summary> |
85 | public InventoryFolderBase RequestUsersRoot(LLUUID userID) | 76 | public InventoryFolderBase RequestUsersRoot(LLUUID userID) |
86 | { | 77 | { |
87 | return _databasePlugin.getInventoryFolder(userID); // the id of the root folder, is the user id | 78 | foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins) |
79 | { | ||
80 | return plugin.Value.getUserRootFolder(userID); | ||
81 | } | ||
82 | return null; | ||
88 | } | 83 | } |
89 | 84 | ||
90 | /// <summary> | 85 | /// <summary> |
@@ -94,27 +89,47 @@ namespace OpenSim.Framework.Communications | |||
94 | /// <returns></returns> | 89 | /// <returns></returns> |
95 | public List<InventoryFolderBase> RequestSubFolders(LLUUID parentFolderID) | 90 | public List<InventoryFolderBase> RequestSubFolders(LLUUID parentFolderID) |
96 | { | 91 | { |
97 | return _databasePlugin.getInventoryFolders(parentFolderID); | 92 | List<InventoryFolderBase> inventoryList = new List<InventoryFolderBase>(); |
93 | foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins) | ||
94 | { | ||
95 | return plugin.Value.getInventoryFolders(parentFolderID); | ||
96 | } | ||
97 | return inventoryList; | ||
98 | } | 98 | } |
99 | 99 | ||
100 | public List<InventoryItemBase> RequestFolderItems(LLUUID folderID) | 100 | public List<InventoryItemBase> RequestFolderItems(LLUUID folderID) |
101 | { | 101 | { |
102 | return _databasePlugin.getInventoryInFolder(folderID); | 102 | List<InventoryItemBase> itemsList = new List<InventoryItemBase>(); |
103 | foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins) | ||
104 | { | ||
105 | itemsList = plugin.Value.getInventoryInFolder(folderID); | ||
106 | return itemsList; | ||
107 | } | ||
108 | return itemsList; | ||
103 | } | 109 | } |
104 | 110 | ||
105 | public void AddFolder(InventoryFolderBase folder) | 111 | public void AddFolder(InventoryFolderBase folder) |
106 | { | 112 | { |
107 | _databasePlugin.addInventoryFolder(folder); | 113 | foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins) |
114 | { | ||
115 | plugin.Value.addInventoryFolder(folder); | ||
116 | } | ||
108 | } | 117 | } |
109 | 118 | ||
110 | public void AddItem(InventoryItemBase item) | 119 | public void AddItem(InventoryItemBase item) |
111 | { | 120 | { |
112 | _databasePlugin.addInventoryItem(item); | 121 | foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins) |
122 | { | ||
123 | plugin.Value.addInventoryItem(item); | ||
124 | } | ||
113 | } | 125 | } |
114 | 126 | ||
115 | public void deleteItem(InventoryItemBase item) | 127 | public void deleteItem(InventoryItemBase item) |
116 | { | 128 | { |
117 | _databasePlugin.deleteInventoryItem(item); | 129 | foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins) |
130 | { | ||
131 | plugin.Value.deleteInventoryItem(item); | ||
132 | } | ||
118 | } | 133 | } |
119 | 134 | ||
120 | /// <summary> | 135 | /// <summary> |
@@ -129,53 +144,11 @@ namespace OpenSim.Framework.Communications | |||
129 | } | 144 | } |
130 | } | 145 | } |
131 | 146 | ||
132 | public void CreateNewUserInventory(LLUUID defaultFolders, LLUUID user) | 147 | public void CreateNewUserInventory(LLUUID user) |
133 | { | 148 | { |
134 | try | 149 | UsersInventory inven = new UsersInventory(); |
135 | { | 150 | inven.CreateNewInventorySet(user); |
136 | // Get Default folder set from the database | 151 | this.AddNewInventorySet(inven); |
137 | //TODO! We need to get the whole hierachy and not just one level down | ||
138 | List<InventoryFolderBase> folders = this.RequestFirstLevelFolders(LLUUID.Parse("00000112-000f-0000-0000-000100bba000")); | ||
139 | |||
140 | // create an index list, where each of the elements has the index of its parent in the hierachy | ||
141 | // this algorithm is pretty shoddy O(n^2), but it is only executed once per user. | ||
142 | int[] parentIdx = new int[folders.Count]; | ||
143 | for (int i = 0; i < folders.Count; i++) | ||
144 | parentIdx[i] = -1; | ||
145 | |||
146 | for (int i = 0; i < folders.Count; i++) | ||
147 | for (int j = 0; j < folders.Count; j++) | ||
148 | if (folders[i].folderID == folders[j].parentID) | ||
149 | parentIdx[j] = i; | ||
150 | |||
151 | |||
152 | //assign a new owerid and a new to the folders | ||
153 | foreach (InventoryFolderBase ifb in folders) | ||
154 | { | ||
155 | if (ifb.parentID == LLUUID.Zero) | ||
156 | ifb.folderID = user; | ||
157 | else | ||
158 | ifb.folderID = LLUUID.Random(); | ||
159 | |||
160 | ifb.agentID = user; | ||
161 | ifb.category = InventoryCategory.User; | ||
162 | } | ||
163 | |||
164 | // correct the parent id | ||
165 | for (int i = 0; i < folders.Count; i++) | ||
166 | { | ||
167 | if (folders[i].parentID != LLUUID.Zero) | ||
168 | folders[i].parentID = folders[parentIdx[i]].folderID; // root folder id is the same as the user id | ||
169 | } | ||
170 | |||
171 | // the list is structurally sound, using new folder id's, so save it | ||
172 | foreach (InventoryFolderBase ifb in folders) | ||
173 | _databasePlugin.addInventoryFolder(ifb); | ||
174 | } | ||
175 | catch (Exception e) | ||
176 | { | ||
177 | MainLog.Instance.Error(e.ToString()); | ||
178 | } | ||
179 | } | 152 | } |
180 | 153 | ||
181 | public class UsersInventory | 154 | public class UsersInventory |
@@ -193,11 +166,10 @@ namespace OpenSim.Framework.Communications | |||
193 | InventoryFolderBase folder = new InventoryFolderBase(); | 166 | InventoryFolderBase folder = new InventoryFolderBase(); |
194 | folder.parentID = LLUUID.Zero; | 167 | folder.parentID = LLUUID.Zero; |
195 | folder.agentID = user; | 168 | folder.agentID = user; |
196 | folder.folderID = user; // id of root folder is the same as the agent id | 169 | folder.folderID = LLUUID.Random(); |
197 | folder.name = "My Inventory"; | 170 | folder.name = "My Inventory"; |
198 | folder.type = 8; | 171 | folder.type = 8; |
199 | folder.version = 1; | 172 | folder.version = 1; |
200 | folder.category = InventoryCategory.User; | ||
201 | Folders.Add(folder.folderID, folder); | 173 | Folders.Add(folder.folderID, folder); |
202 | 174 | ||
203 | LLUUID rootFolder = folder.folderID; | 175 | LLUUID rootFolder = folder.folderID; |
@@ -209,7 +181,6 @@ namespace OpenSim.Framework.Communications | |||
209 | folder.name = "Textures"; | 181 | folder.name = "Textures"; |
210 | folder.type = 0; | 182 | folder.type = 0; |
211 | folder.version = 1; | 183 | folder.version = 1; |
212 | folder.category = InventoryCategory.User; | ||
213 | Folders.Add(folder.folderID, folder); | 184 | Folders.Add(folder.folderID, folder); |
214 | 185 | ||
215 | folder = new InventoryFolderBase(); | 186 | folder = new InventoryFolderBase(); |
@@ -219,7 +190,6 @@ namespace OpenSim.Framework.Communications | |||
219 | folder.name = "Objects"; | 190 | folder.name = "Objects"; |
220 | folder.type = 6; | 191 | folder.type = 6; |
221 | folder.version = 1; | 192 | folder.version = 1; |
222 | folder.category = InventoryCategory.User; | ||
223 | Folders.Add(folder.folderID, folder); | 193 | Folders.Add(folder.folderID, folder); |
224 | 194 | ||
225 | folder = new InventoryFolderBase(); | 195 | folder = new InventoryFolderBase(); |
@@ -229,130 +199,13 @@ namespace OpenSim.Framework.Communications | |||
229 | folder.name = "Clothes"; | 199 | folder.name = "Clothes"; |
230 | folder.type = 5; | 200 | folder.type = 5; |
231 | folder.version = 1; | 201 | folder.version = 1; |
232 | folder.category = InventoryCategory.User; | ||
233 | Folders.Add(folder.folderID, folder); | 202 | Folders.Add(folder.folderID, folder); |
234 | } | 203 | } |
235 | } | 204 | } |
236 | 205 | ||
237 | |||
238 | public void GetRootFoldersForUser(LLUUID user, out LLUUID libraryFolder, out LLUUID personalFolder) | ||
239 | { | ||
240 | List<InventoryFolderBase> folders = _databasePlugin.getUserRootFolders(user); | ||
241 | libraryFolder = LLUUID.Zero; | ||
242 | personalFolder = LLUUID.Zero; | ||
243 | |||
244 | for (int i = 0; i < folders.Count; i++) | ||
245 | { | ||
246 | if (folders[i].category == InventoryCategory.Library) | ||
247 | libraryFolder = folders[i].folderID; | ||
248 | else if (folders[i].category == InventoryCategory.User) | ||
249 | personalFolder = folders[i].folderID; | ||
250 | } | ||
251 | } | ||
252 | |||
253 | /* | ||
254 | * Dot net has some issues, serializing a dictionary, so we cannot reuse the InventoryFolder | ||
255 | * class defined in Communications.Framework.Communications.Caches. So we serialize/deserialize | ||
256 | * into this simpler class, and then use that. | ||
257 | */ | ||
258 | [XmlRoot(ElementName = "inventory", IsNullable = true)] | ||
259 | public class SerializedInventory | ||
260 | { | ||
261 | [XmlRoot(ElementName = "folder", IsNullable = true)] | ||
262 | public class SerializedFolder : InventoryFolderBase | ||
263 | { | ||
264 | [XmlArray(ElementName = "folders", IsNullable = true)] | ||
265 | [XmlArrayItem(ElementName = "folder", IsNullable = true, Type = typeof(SerializedFolder))] | ||
266 | public ArrayList SubFolders; | ||
267 | |||
268 | [XmlArray(ElementName = "items", IsNullable = true)] | ||
269 | [XmlArrayItem(ElementName = "item", IsNullable = true, Type = typeof(InventoryItemBase))] | ||
270 | public ArrayList Items; | ||
271 | } | ||
272 | |||
273 | [XmlElement(ElementName = "folder", IsNullable = true)] | ||
274 | public SerializedFolder root; | ||
275 | } | ||
276 | |||
277 | public void uploadInventory(SerializedInventory.SerializedFolder folder) | ||
278 | { | ||
279 | foreach (InventoryItemBase iib in folder.Items) | ||
280 | { | ||
281 | // assign default values, if they haven't assigned | ||
282 | iib.avatarID = folder.agentID; | ||
283 | if (iib.assetID == LLUUID.Zero) | ||
284 | iib.assetID = LLUUID.Random(); | ||
285 | if (iib.creatorsID == LLUUID.Zero) | ||
286 | iib.creatorsID = folder.agentID; | ||
287 | if (iib.inventoryID == LLUUID.Zero) | ||
288 | iib.inventoryID = LLUUID.Random(); | ||
289 | if (iib.inventoryName == null || iib.inventoryName.Length == 0) | ||
290 | iib.inventoryName = "new item"; | ||
291 | iib.parentFolderID = folder.folderID; | ||
292 | |||
293 | _databasePlugin.addInventoryItem(iib); | ||
294 | } | ||
295 | |||
296 | foreach (SerializedInventory.SerializedFolder sf in folder.SubFolders) | ||
297 | { | ||
298 | // assign default values, if they haven't assigned | ||
299 | sf.agentID = folder.agentID; | ||
300 | sf.category = folder.category; | ||
301 | if (sf.folderID == LLUUID.Zero) | ||
302 | sf.folderID = LLUUID.Random(); | ||
303 | if (sf.name == null || sf.name.Length == 0) | ||
304 | sf.name = "new folder"; | ||
305 | sf.parentID = folder.folderID; | ||
306 | |||
307 | _databasePlugin.addInventoryFolder(sf); | ||
308 | uploadInventory(sf); | ||
309 | } | ||
310 | } | ||
311 | |||
312 | public void loadInventoryFromXmlFile(InventoryCategory inventoryCategory, string fileName) | ||
313 | { | ||
314 | _databasePlugin.deleteInventoryCategory(inventoryCategory); | ||
315 | |||
316 | FileStream fs = new FileStream(fileName, FileMode.Open, FileAccess.Read); | ||
317 | XmlReader reader = new XmlTextReader(fs); | ||
318 | XmlSerializer x = new XmlSerializer(typeof(SerializedInventory)); | ||
319 | SerializedInventory inventory = (SerializedInventory)x.Deserialize(reader); | ||
320 | |||
321 | // the library and default inventories has no owner, so we use a random guid. | ||
322 | if (inventory.root.category == InventoryCategory.Library || inventory.root.category == InventoryCategory.Default) | ||
323 | { | ||
324 | if (inventory.root.folderID != LLUUID.Zero) | ||
325 | inventory.root.agentID = inventory.root.folderID; | ||
326 | else | ||
327 | inventory.root.agentID = LLUUID.Random(); | ||
328 | } | ||
329 | else if (inventory.root.category == InventoryCategory.User) | ||
330 | { | ||
331 | if (inventory.root.agentID == LLUUID.Zero) | ||
332 | inventory.root.agentID = LLUUID.Random(); | ||
333 | } | ||
334 | |||
335 | inventory.root.folderID = inventory.root.agentID; // the root folder always has the same id as the owning agent | ||
336 | inventory.root.parentID = LLUUID.Zero; | ||
337 | inventory.root.version = 0; | ||
338 | inventory.root.category = inventoryCategory; | ||
339 | |||
340 | _databasePlugin.addInventoryFolder(inventory.root); | ||
341 | uploadInventory(inventory.root); | ||
342 | } | ||
343 | |||
344 | protected void saveInventoryToXmlFile(SerializedInventory inventory, string fileName) | ||
345 | { | ||
346 | FileStream fs = new FileStream(fileName, FileMode.Create, FileAccess.Write); | ||
347 | XmlTextWriter writer = new XmlTextWriter(fs, Encoding.UTF8); | ||
348 | writer.Formatting = Formatting.Indented; | ||
349 | XmlSerializer x = new XmlSerializer(typeof(SerializedInventory)); | ||
350 | x.Serialize(writer, inventory); | ||
351 | } | ||
352 | |||
353 | public abstract void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack, InventoryItemInfo itemCallBack); | 206 | public abstract void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack, InventoryItemInfo itemCallBack); |
354 | public abstract void AddNewInventoryFolder(LLUUID userID, InventoryFolderBase folder); | 207 | public abstract void AddNewInventoryFolder(LLUUID userID, InventoryFolder folder); |
355 | public abstract void AddNewInventoryItem(LLUUID userID, InventoryItemBase item); | 208 | public abstract void AddNewInventoryItem(LLUUID userID, InventoryItemBase item); |
356 | public abstract void DeleteInventoryItem(LLUUID userID, InventoryItemBase item); | 209 | public abstract void DeleteInventoryItem(LLUUID userID, InventoryItemBase item); |
357 | } | 210 | } |
358 | } | 211 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/Communications/LoginResponse.cs b/OpenSim/Framework/Communications/LoginResponse.cs index b4280e7..b5a4184 100644 --- a/OpenSim/Framework/Communications/LoginResponse.cs +++ b/OpenSim/Framework/Communications/LoginResponse.cs | |||
@@ -26,10 +26,9 @@ namespace OpenSim.Framework.UserManagement | |||
26 | private ArrayList classifiedCategories; | 26 | private ArrayList classifiedCategories; |
27 | private ArrayList inventoryRoot; | 27 | private ArrayList inventoryRoot; |
28 | private ArrayList initialOutfit; | 28 | private ArrayList initialOutfit; |
29 | private ArrayList inventorySkeleton; | 29 | private ArrayList agentInventory; |
30 | private ArrayList inventoryLibraryOwner; | 30 | private ArrayList inventoryLibraryOwner; |
31 | private ArrayList inventoryLibraryRoot; | 31 | private ArrayList inventoryLibrary; |
32 | private ArrayList inventoryLibrarySkeleton; | ||
33 | 32 | ||
34 | private UserInfo userProfile; | 33 | private UserInfo userProfile; |
35 | 34 | ||
@@ -87,13 +86,11 @@ namespace OpenSim.Framework.UserManagement | |||
87 | 86 | ||
88 | this.defaultXmlRpcResponse = new XmlRpcResponse(); | 87 | this.defaultXmlRpcResponse = new XmlRpcResponse(); |
89 | this.userProfile = new UserInfo(); | 88 | this.userProfile = new UserInfo(); |
90 | |||
91 | this.initialOutfit = new ArrayList(); | ||
92 | this.inventoryRoot = new ArrayList(); | 89 | this.inventoryRoot = new ArrayList(); |
93 | this.inventorySkeleton = new ArrayList(); | 90 | this.initialOutfit = new ArrayList(); |
94 | this.inventoryLibrarySkeleton = new ArrayList(); | 91 | this.agentInventory = new ArrayList(); |
92 | this.inventoryLibrary = new ArrayList(); | ||
95 | this.inventoryLibraryOwner = new ArrayList(); | 93 | this.inventoryLibraryOwner = new ArrayList(); |
96 | this.inventoryLibraryRoot = new ArrayList(); | ||
97 | 94 | ||
98 | this.xmlRpcResponse = new XmlRpcResponse(); | 95 | this.xmlRpcResponse = new XmlRpcResponse(); |
99 | this.defaultXmlRpcResponse = new XmlRpcResponse(); | 96 | this.defaultXmlRpcResponse = new XmlRpcResponse(); |
@@ -240,15 +237,12 @@ namespace OpenSim.Framework.UserManagement | |||
240 | responseData["classified_categories"] = this.classifiedCategories; | 237 | responseData["classified_categories"] = this.classifiedCategories; |
241 | responseData["ui-config"] = this.uiConfig; | 238 | responseData["ui-config"] = this.uiConfig; |
242 | 239 | ||
243 | responseData["inventory-skeleton"] = this.inventorySkeleton; | 240 | responseData["inventory-skeleton"] = this.agentInventory; |
244 | responseData["inventory-skel-lib"] = this.inventoryLibrarySkeleton; | 241 | responseData["inventory-skel-lib"] = this.inventoryLibrary; |
245 | responseData["inventory-root"] = this.inventoryRoot; | 242 | responseData["inventory-root"] = this.inventoryRoot; |
246 | responseData["inventory-lib-owner"] = this.inventoryLibraryOwner; | ||
247 | responseData["inventory-lib-root"] = this.inventoryLibraryRoot; | ||
248 | |||
249 | responseData["gestures"] = new ArrayList(); // todo | 243 | responseData["gestures"] = new ArrayList(); // todo |
244 | responseData["inventory-lib-owner"] = this.inventoryLibraryOwner; | ||
250 | responseData["initial-outfit"] = this.initialOutfit; | 245 | responseData["initial-outfit"] = this.initialOutfit; |
251 | |||
252 | responseData["start_location"] = this.startLocation; | 246 | responseData["start_location"] = this.startLocation; |
253 | responseData["seed_capability"] = this.seedCapability; | 247 | responseData["seed_capability"] = this.seedCapability; |
254 | responseData["home"] = this.home; | 248 | responseData["home"] = this.home; |
@@ -602,23 +596,23 @@ namespace OpenSim.Framework.UserManagement | |||
602 | { | 596 | { |
603 | get | 597 | get |
604 | { | 598 | { |
605 | return this.inventorySkeleton; | 599 | return this.agentInventory; |
606 | } | 600 | } |
607 | set | 601 | set |
608 | { | 602 | { |
609 | this.inventorySkeleton = value; | 603 | this.agentInventory = value; |
610 | } | 604 | } |
611 | } | 605 | } |
612 | 606 | ||
613 | public ArrayList InventoryLibrarySkeleton | 607 | public ArrayList InventoryLibrary |
614 | { | 608 | { |
615 | get | 609 | get |
616 | { | 610 | { |
617 | return this.inventoryLibrarySkeleton; | 611 | return this.inventoryLibrary; |
618 | } | 612 | } |
619 | set | 613 | set |
620 | { | 614 | { |
621 | this.inventoryLibrarySkeleton = value; | 615 | this.inventoryLibrary = value; |
622 | } | 616 | } |
623 | } | 617 | } |
624 | 618 | ||
@@ -634,18 +628,6 @@ namespace OpenSim.Framework.UserManagement | |||
634 | } | 628 | } |
635 | } | 629 | } |
636 | 630 | ||
637 | public ArrayList InventoryLibraryRoot | ||
638 | { | ||
639 | get | ||
640 | { | ||
641 | return this.inventoryLibraryRoot; | ||
642 | } | ||
643 | set | ||
644 | { | ||
645 | this.inventoryLibraryRoot = value; | ||
646 | } | ||
647 | } | ||
648 | |||
649 | public string Home | 631 | public string Home |
650 | { | 632 | { |
651 | get | 633 | get |
@@ -683,7 +665,3 @@ namespace OpenSim.Framework.UserManagement | |||
683 | } | 665 | } |
684 | } | 666 | } |
685 | 667 | ||
686 | |||
687 | |||
688 | |||
689 | |||
diff --git a/OpenSim/Framework/Communications/LoginService.cs b/OpenSim/Framework/Communications/LoginService.cs index 4e6aa80..8e7cf80 100644 --- a/OpenSim/Framework/Communications/LoginService.cs +++ b/OpenSim/Framework/Communications/LoginService.cs | |||
@@ -8,10 +8,11 @@ using Nwc.XmlRpc; | |||
8 | using OpenSim.Framework.Console; | 8 | using OpenSim.Framework.Console; |
9 | using OpenSim.Framework.Data; | 9 | using OpenSim.Framework.Data; |
10 | using OpenSim.Framework.Interfaces; | 10 | using OpenSim.Framework.Interfaces; |
11 | using OpenSim.Framework.Inventory; | ||
11 | using OpenSim.Framework.Utilities; | 12 | using OpenSim.Framework.Utilities; |
12 | using OpenSim.Framework.Communications; | ||
13 | using OpenSim.Framework.Configuration; | ||
14 | 13 | ||
14 | using OpenSim.Framework.Configuration; | ||
15 | using InventoryFolder = OpenSim.Framework.Inventory.InventoryFolder; | ||
15 | 16 | ||
16 | namespace OpenSim.Framework.UserManagement | 17 | namespace OpenSim.Framework.UserManagement |
17 | { | 18 | { |
@@ -19,12 +20,10 @@ namespace OpenSim.Framework.UserManagement | |||
19 | { | 20 | { |
20 | protected string m_welcomeMessage = "Welcome to OpenSim"; | 21 | protected string m_welcomeMessage = "Welcome to OpenSim"; |
21 | protected UserManagerBase m_userManager = null; | 22 | protected UserManagerBase m_userManager = null; |
22 | protected IInventoryServices m_inventoryServer = null; | ||
23 | 23 | ||
24 | public LoginService(UserManagerBase userManager, IInventoryServices inventoryServer, string welcomeMess) | 24 | public LoginService(UserManagerBase userManager, string welcomeMess) |
25 | { | 25 | { |
26 | m_userManager = userManager; | 26 | m_userManager = userManager; |
27 | m_inventoryServer = inventoryServer; | ||
28 | if (welcomeMess != "") | 27 | if (welcomeMess != "") |
29 | { | 28 | { |
30 | m_welcomeMessage = welcomeMess; | 29 | m_welcomeMessage = welcomeMess; |
@@ -38,6 +37,7 @@ namespace OpenSim.Framework.UserManagement | |||
38 | /// <returns>The response to send</returns> | 37 | /// <returns>The response to send</returns> |
39 | public XmlRpcResponse XmlRpcLoginMethod(XmlRpcRequest request) | 38 | public XmlRpcResponse XmlRpcLoginMethod(XmlRpcRequest request) |
40 | { | 39 | { |
40 | |||
41 | System.Console.WriteLine("Attempting login now..."); | 41 | System.Console.WriteLine("Attempting login now..."); |
42 | XmlRpcResponse response = new XmlRpcResponse(); | 42 | XmlRpcResponse response = new XmlRpcResponse(); |
43 | Hashtable requestData = (Hashtable)request.Params[0]; | 43 | Hashtable requestData = (Hashtable)request.Params[0]; |
@@ -85,41 +85,15 @@ namespace OpenSim.Framework.UserManagement | |||
85 | { | 85 | { |
86 | LLUUID agentID = userProfile.UUID; | 86 | LLUUID agentID = userProfile.UUID; |
87 | 87 | ||
88 | LLUUID libraryFolderID; | 88 | // Inventory Library Section |
89 | LLUUID personalFolderID; | 89 | InventoryData inventData = this.CreateInventoryData(agentID); |
90 | 90 | ArrayList AgentInventoryArray = inventData.InventoryArray; | |
91 | m_inventoryServer.GetRootFoldersForUser(agentID, out libraryFolderID, out personalFolderID); | ||
92 | if (personalFolderID == LLUUID.Zero) | ||
93 | { | ||
94 | m_inventoryServer.CreateNewUserInventory(libraryFolderID, agentID); | ||
95 | m_inventoryServer.GetRootFoldersForUser(agentID, out libraryFolderID, out personalFolderID); | ||
96 | } | ||
97 | |||
98 | // The option "inventory-lib-owner" requires that we return the id of the | ||
99 | // owner of the library inventory. | ||
100 | Hashtable dynamicStruct = new Hashtable(); | ||
101 | dynamicStruct["agent_id"] = libraryFolderID.ToStringHyphenated(); | ||
102 | logResponse.InventoryLibraryOwner.Add(dynamicStruct); | ||
103 | |||
104 | // The option "inventory-lib-root" requires that we return the id of the | ||
105 | // root folder of the library inventory. | ||
106 | dynamicStruct = new Hashtable(); | ||
107 | dynamicStruct["folder_id"] = libraryFolderID.ToStringHyphenated(); | ||
108 | logResponse.InventoryLibraryRoot.Add(dynamicStruct); | ||
109 | 91 | ||
110 | // The option "inventory-root" requires that we return the id of the | 92 | Hashtable InventoryRootHash = new Hashtable(); |
111 | // root folder of the users inventory. | 93 | InventoryRootHash["folder_id"] = inventData.RootFolderID.ToStringHyphenated(); |
112 | dynamicStruct = new Hashtable(); | 94 | ArrayList InventoryRoot = new ArrayList(); |
113 | dynamicStruct["folder_id"] = personalFolderID.ToStringHyphenated(); | 95 | InventoryRoot.Add(InventoryRootHash); |
114 | logResponse.InventoryRoot.Add(dynamicStruct); | 96 | userProfile.rootInventoryFolderID = inventData.RootFolderID; |
115 | |||
116 | // The option "inventory-skeleton" requires that we return the structure of the | ||
117 | // users folder hierachy | ||
118 | logResponse.InventorySkeleton = GetInventorySkeleton(personalFolderID); | ||
119 | |||
120 | // The option "inventory-skel-lib" requires that we return the structure of the | ||
121 | // library folder hierachy | ||
122 | logResponse.InventoryLibrarySkeleton = GetInventorySkeleton(libraryFolderID); | ||
123 | 97 | ||
124 | // Circuit Code | 98 | // Circuit Code |
125 | uint circode = (uint)(Util.RandomClass.Next()); | 99 | uint circode = (uint)(Util.RandomClass.Next()); |
@@ -129,6 +103,10 @@ namespace OpenSim.Framework.UserManagement | |||
129 | logResponse.AgentID = agentID.ToStringHyphenated(); | 103 | logResponse.AgentID = agentID.ToStringHyphenated(); |
130 | logResponse.SessionID = userProfile.currentAgent.sessionID.ToStringHyphenated(); | 104 | logResponse.SessionID = userProfile.currentAgent.sessionID.ToStringHyphenated(); |
131 | logResponse.SecureSessionID = userProfile.currentAgent.secureSessionID.ToStringHyphenated(); | 105 | logResponse.SecureSessionID = userProfile.currentAgent.secureSessionID.ToStringHyphenated(); |
106 | logResponse.InventoryRoot = InventoryRoot; | ||
107 | logResponse.InventorySkeleton = AgentInventoryArray; | ||
108 | logResponse.InventoryLibrary = this.GetInventoryLibrary(); | ||
109 | logResponse.InventoryLibraryOwner = this.GetLibraryOwner(); | ||
132 | logResponse.CircuitCode = (Int32)circode; | 110 | logResponse.CircuitCode = (Int32)circode; |
133 | //logResponse.RegionX = 0; //overwritten | 111 | //logResponse.RegionX = 0; //overwritten |
134 | //logResponse.RegionY = 0; //overwritten | 112 | //logResponse.RegionY = 0; //overwritten |
@@ -234,30 +212,76 @@ namespace OpenSim.Framework.UserManagement | |||
234 | } | 212 | } |
235 | 213 | ||
236 | /// <summary> | 214 | /// <summary> |
237 | /// Create a structure of the generic inventory structure of a specified folder | 215 | /// |
216 | /// </summary> | ||
217 | /// <returns></returns> | ||
218 | protected virtual ArrayList GetInventoryLibrary() | ||
219 | { | ||
220 | //return new ArrayList(); | ||
221 | Hashtable TempHash = new Hashtable(); | ||
222 | TempHash["name"] = "OpenSim Library"; | ||
223 | TempHash["parent_id"] = LLUUID.Zero.ToStringHyphenated(); | ||
224 | TempHash["version"] = 1; | ||
225 | TempHash["type_default"] = -1; | ||
226 | TempHash["folder_id"] = "00000112-000f-0000-0000-000100bba000"; | ||
227 | ArrayList temp = new ArrayList(); | ||
228 | temp.Add(TempHash); | ||
229 | |||
230 | TempHash = new Hashtable(); | ||
231 | TempHash["name"] = "Texture Library"; | ||
232 | TempHash["parent_id"] = "00000112-000f-0000-0000-000100bba000"; | ||
233 | TempHash["version"] = 1; | ||
234 | TempHash["type_default"] = -1; | ||
235 | TempHash["folder_id"] = "00000112-000f-0000-0000-000100bba001"; | ||
236 | temp.Add(TempHash); | ||
237 | return temp; | ||
238 | } | ||
239 | |||
240 | /// <summary> | ||
241 | /// | ||
238 | /// </summary> | 242 | /// </summary> |
239 | /// <returns></returns> | 243 | /// <returns></returns> |
240 | protected virtual ArrayList GetInventorySkeleton(LLUUID folderID) | 244 | protected virtual ArrayList GetLibraryOwner() |
241 | { | 245 | { |
246 | //for now create random inventory library owner | ||
247 | Hashtable TempHash = new Hashtable(); | ||
248 | TempHash["agent_id"] = "11111111-1111-0000-0000-000100bba000"; | ||
249 | ArrayList inventoryLibOwner = new ArrayList(); | ||
250 | inventoryLibOwner.Add(TempHash); | ||
251 | return inventoryLibOwner; | ||
252 | } | ||
242 | 253 | ||
243 | List<InventoryFolderBase> folders = m_inventoryServer.RequestFirstLevelFolders(folderID); | 254 | protected virtual InventoryData CreateInventoryData(LLUUID userID) |
255 | { | ||
256 | AgentInventory userInventory = new AgentInventory(); | ||
257 | userInventory.CreateRootFolder(userID, false); | ||
244 | 258 | ||
245 | ArrayList temp = new ArrayList(); | 259 | ArrayList AgentInventoryArray = new ArrayList(); |
246 | foreach (InventoryFolderBase ifb in folders) | 260 | Hashtable TempHash; |
261 | foreach (InventoryFolder InvFolder in userInventory.InventoryFolders.Values) | ||
247 | { | 262 | { |
248 | LLUUID tempFolderID = ifb.folderID; | 263 | TempHash = new Hashtable(); |
249 | LLUUID tempParentID = ifb.parentID; | 264 | TempHash["name"] = InvFolder.FolderName; |
250 | 265 | TempHash["parent_id"] = InvFolder.ParentID.ToStringHyphenated(); | |
251 | Hashtable TempHash = new Hashtable(); | 266 | TempHash["version"] = (Int32)InvFolder.Version; |
252 | TempHash["folder_id"] = tempFolderID.ToStringHyphenated(); | 267 | TempHash["type_default"] = (Int32)InvFolder.DefaultType; |
253 | TempHash["name"] = ifb.name; | 268 | TempHash["folder_id"] = InvFolder.FolderID.ToStringHyphenated(); |
254 | TempHash["parent_id"] = tempParentID.ToStringHyphenated(); | 269 | AgentInventoryArray.Add(TempHash); |
255 | TempHash["type_default"] = (Int32)ifb.type; | ||
256 | TempHash["version"] = (Int32)ifb.version+1; | ||
257 | temp.Add(TempHash); | ||
258 | } | 270 | } |
259 | 271 | ||
260 | return temp; | 272 | return new InventoryData(AgentInventoryArray, userInventory.InventoryRoot.FolderID); |
273 | } | ||
274 | |||
275 | public class InventoryData | ||
276 | { | ||
277 | public ArrayList InventoryArray = null; | ||
278 | public LLUUID RootFolderID = LLUUID.Zero; | ||
279 | |||
280 | public InventoryData(ArrayList invList, LLUUID rootID) | ||
281 | { | ||
282 | InventoryArray = invList; | ||
283 | RootFolderID = rootID; | ||
284 | } | ||
261 | } | 285 | } |
262 | } | 286 | } |
263 | } | 287 | } |