aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework
diff options
context:
space:
mode:
authorlbsa712007-09-27 13:25:45 +0000
committerlbsa712007-09-27 13:25:45 +0000
commit8143c597fc5f62ec0d931d2d5b887730e06aec04 (patch)
treeae67873a5f801b2b7bdf9a7b088db98beb97b5ac /OpenSim/Framework
parentTerrain: (diff)
downloadopensim-SC_OLD-8143c597fc5f62ec0d931d2d5b887730e06aec04.zip
opensim-SC_OLD-8143c597fc5f62ec0d931d2d5b887730e06aec04.tar.gz
opensim-SC_OLD-8143c597fc5f62ec0d931d2d5b887730e06aec04.tar.bz2
opensim-SC_OLD-8143c597fc5f62ec0d931d2d5b887730e06aec04.tar.xz
* Tleiades grid mode inventory (#444) - thanx Tleiades!
* updated to rev 1413 on libsecondlife.dll and libsecondlife.dll.config (#423)
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r--OpenSim/Framework/Communications/CAPSService.cs1
-rw-r--r--OpenSim/Framework/Communications/Cache/CachedUserInfo.cs14
-rw-r--r--OpenSim/Framework/Communications/Cache/InventoryFolder.cs12
-rw-r--r--OpenSim/Framework/Communications/Cache/UserProfileCache.cs32
-rw-r--r--OpenSim/Framework/Communications/IInventoryServices.cs16
-rw-r--r--OpenSim/Framework/Communications/InventoryServiceBase.cs255
-rw-r--r--OpenSim/Framework/Communications/LoginResponse.cs48
-rw-r--r--OpenSim/Framework/Communications/LoginService.cs134
-rw-r--r--OpenSim/Framework/Data.MySQL/MySQLInventoryData.cs58
-rw-r--r--OpenSim/Framework/Data.MySQL/MySQLManager.cs58
-rw-r--r--OpenSim/Framework/Data.SQLite/SQLiteInventoryStore.cs61
-rw-r--r--OpenSim/Framework/Data/InventoryData.cs33
-rw-r--r--OpenSim/Framework/General/Configuration/InventoryConfig.cs67
-rw-r--r--OpenSim/Framework/General/Configuration/UserConfig.cs11
-rw-r--r--OpenSim/Framework/General/Types/NetworkServersInfo.cs5
-rw-r--r--OpenSim/Framework/General/Types/UUID.cs4
16 files changed, 543 insertions, 266 deletions
diff --git a/OpenSim/Framework/Communications/CAPSService.cs b/OpenSim/Framework/Communications/CAPSService.cs
index a8eac26..40d8d37 100644
--- a/OpenSim/Framework/Communications/CAPSService.cs
+++ b/OpenSim/Framework/Communications/CAPSService.cs
@@ -8,7 +8,6 @@ using Nwc.XmlRpc;
8using OpenSim.Framework.Console; 8using OpenSim.Framework.Console;
9using OpenSim.Framework.Data; 9using OpenSim.Framework.Data;
10using OpenSim.Framework.Interfaces; 10using OpenSim.Framework.Interfaces;
11using OpenSim.Framework.Inventory;
12using OpenSim.Framework.Utilities; 11using OpenSim.Framework.Utilities;
13using OpenSim.Framework.Servers; 12using OpenSim.Framework.Servers;
14 13
diff --git a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
index 99dc45a..9e8c239 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
39namespace OpenSim.Framework.Communications.Caches 39namespace OpenSim.Framework.Communications.Caches
40{ 40{
41 public class CachedUserInfo 41 public class CachedUserInfo : MarshalByRefObject
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, InventoryFolder folderInfo) 54 public void FolderReceive(LLUUID userID, InventoryFolderBase 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 = folderInfo; 62 this.RootFolder = new InventoryFolder(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, folderInfo); 67 this.RootFolder.SubFolders.Add(folderInfo.folderID, new InventoryFolder(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, folderInfo); 74 folder.SubFolders.Add(folderInfo.folderID, new InventoryFolder(folderInfo));
75 } 75 }
76 } 76 }
77 } 77 }
@@ -131,3 +131,7 @@ 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 885cffc..a212614 100644
--- a/OpenSim/Framework/Communications/Cache/InventoryFolder.cs
+++ b/OpenSim/Framework/Communications/Cache/InventoryFolder.cs
@@ -35,6 +35,9 @@ using OpenSim.Framework.Interfaces;
35using OpenSim.Framework.Data; 35using OpenSim.Framework.Data;
36using OpenSim.Framework.Types; 36using OpenSim.Framework.Types;
37using OpenSim.Framework.Utilities; 37using OpenSim.Framework.Utilities;
38using OpenSim.Framework.Console;
39
40using InventoryCategory = OpenSim.Framework.Data.InventoryCategory;
38 41
39namespace OpenSim.Framework.Communications.Caches 42namespace OpenSim.Framework.Communications.Caches
40{ 43{
@@ -60,7 +63,7 @@ namespace OpenSim.Framework.Communications.Caches
60 } 63 }
61 64
62 // Methods 65 // Methods
63 public InventoryFolder CreateNewSubFolder(LLUUID folderID, string folderName, ushort type) 66 public InventoryFolder CreateNewSubFolder(LLUUID folderID, string folderName, ushort type, InventoryCategory category)
64 { 67 {
65 InventoryFolder subFold = new InventoryFolder(); 68 InventoryFolder subFold = new InventoryFolder();
66 subFold.name = folderName; 69 subFold.name = folderName;
@@ -68,7 +71,12 @@ namespace OpenSim.Framework.Communications.Caches
68 subFold.type = (short) type; 71 subFold.type = (short) type;
69 subFold.parentID = this.folderID; 72 subFold.parentID = this.folderID;
70 subFold.agentID = this.agentID; 73 subFold.agentID = this.agentID;
71 this.SubFolders.Add(subFold.folderID, subFold); 74 subFold.category = category;
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
72 return subFold; 80 return subFold;
73 } 81 }
74 82
diff --git a/OpenSim/Framework/Communications/Cache/UserProfileCache.cs b/OpenSim/Framework/Communications/Cache/UserProfileCache.cs
index 390b938..3dadf9c 100644
--- a/OpenSim/Framework/Communications/Cache/UserProfileCache.cs
+++ b/OpenSim/Framework/Communications/Cache/UserProfileCache.cs
@@ -35,10 +35,11 @@ using OpenSim.Framework.Interfaces;
35using OpenSim.Framework.Types; 35using OpenSim.Framework.Types;
36using OpenSim.Framework.Utilities; 36using OpenSim.Framework.Utilities;
37using OpenSim.Framework.Data; 37using OpenSim.Framework.Data;
38using InventoryCategory = OpenSim.Framework.Data.InventoryCategory;
38 39
39namespace OpenSim.Framework.Communications.Caches 40namespace OpenSim.Framework.Communications.Caches
40{ 41{
41 public class UserProfileCache 42 public class UserProfileCache : MarshalByRefObject
42 { 43 {
43 // Fields 44 // Fields
44 private CommunicationsManager m_parent; 45 private CommunicationsManager m_parent;
@@ -103,7 +104,7 @@ namespace OpenSim.Framework.Communications.Caches
103 CachedUserInfo info = this.UserProfiles[remoteClient.AgentId]; 104 CachedUserInfo info = this.UserProfiles[remoteClient.AgentId];
104 if (info.RootFolder.folderID == parentID) 105 if (info.RootFolder.folderID == parentID)
105 { 106 {
106 InventoryFolder createdFolder = info.RootFolder.CreateNewSubFolder(folderID, folderName, folderType); 107 InventoryFolder createdFolder = info.RootFolder.CreateNewSubFolder(folderID, folderName, folderType, InventoryCategory.User);
107 if (createdFolder != null) 108 if (createdFolder != null)
108 { 109 {
109 this.m_parent.InventoryService.AddNewInventoryFolder(remoteClient.AgentId, createdFolder); 110 this.m_parent.InventoryService.AddNewInventoryFolder(remoteClient.AgentId, createdFolder);
@@ -114,7 +115,7 @@ namespace OpenSim.Framework.Communications.Caches
114 InventoryFolder folder = info.RootFolder.HasSubFolder(parentID); 115 InventoryFolder folder = info.RootFolder.HasSubFolder(parentID);
115 if (folder != null) 116 if (folder != null)
116 { 117 {
117 folder.CreateNewSubFolder(folderID, folderName, folderType); 118 folder.CreateNewSubFolder(folderID, folderName, folderType, InventoryCategory.User);
118 } 119 }
119 } 120 }
120 } 121 }
@@ -124,16 +125,21 @@ namespace OpenSim.Framework.Communications.Caches
124 public void HandleFecthInventoryDescendents(IClientAPI remoteClient, LLUUID folderID, LLUUID ownerID, bool fetchFolders, bool fetchItems, int sortOrder) 125 public void HandleFecthInventoryDescendents(IClientAPI remoteClient, LLUUID folderID, LLUUID ownerID, bool fetchFolders, bool fetchItems, int sortOrder)
125 { 126 {
126 InventoryFolder fold = null; 127 InventoryFolder fold = null;
128
127 if (folderID == libraryRoot.folderID ) 129 if (folderID == libraryRoot.folderID )
128 { 130 {
131 // we are looking for the root of the shared inventory
129 remoteClient.SendInventoryFolderDetails(libraryRoot.agentID, libraryRoot.folderID, libraryRoot.RequestListOfItems()); 132 remoteClient.SendInventoryFolderDetails(libraryRoot.agentID, libraryRoot.folderID, libraryRoot.RequestListOfItems());
130 } 133 }
131 else if (( fold = libraryRoot.HasSubFolder(folderID)) != null) 134 else if (( fold = libraryRoot.HasSubFolder(folderID)) != null)
132 { 135 {
136 // we are looking for a sub folder of the shared inventory
133 remoteClient.SendInventoryFolderDetails(libraryRoot.agentID, folderID, fold.RequestListOfItems()); 137 remoteClient.SendInventoryFolderDetails(libraryRoot.agentID, folderID, fold.RequestListOfItems());
134 } 138 }
135 else if (this.UserProfiles.ContainsKey(remoteClient.AgentId)) 139 else if (this.UserProfiles.ContainsKey(remoteClient.AgentId))
136 { 140 {
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
137 if (this.UserProfiles[remoteClient.AgentId].RootFolder != null) 143 if (this.UserProfiles[remoteClient.AgentId].RootFolder != null)
138 { 144 {
139 CachedUserInfo info = this.UserProfiles[remoteClient.AgentId]; 145 CachedUserInfo info = this.UserProfiles[remoteClient.AgentId];
@@ -153,9 +159,23 @@ namespace OpenSim.Framework.Communications.Caches
153 } 159 }
154 } 160 }
155 } 161 }
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 }
156 } 167 }
157 } 168 }
158 169
170 public void ReceiveFolderInfo(LLUUID userID, InventoryFolderBase folderInfo)
171 {
172 }
173
174 public void ReceiveItemInfo(LLUUID userID, InventoryItemBase itemInfo)
175 {
176 }
177
178
159 public void HandleFetchInventory(IClientAPI remoteClient, LLUUID itemID, LLUUID ownerID) 179 public void HandleFetchInventory(IClientAPI remoteClient, LLUUID itemID, LLUUID ownerID)
160 { 180 {
161 if (ownerID == libraryRoot.agentID) 181 if (ownerID == libraryRoot.agentID)
@@ -181,7 +201,7 @@ namespace OpenSim.Framework.Communications.Caches
181 /// <param name="userID"></param> 201 /// <param name="userID"></param>
182 private void RequestInventoryForUser(LLUUID userID, CachedUserInfo userInfo) 202 private void RequestInventoryForUser(LLUUID userID, CachedUserInfo userInfo)
183 { 203 {
184 this.m_parent.InventoryService.RequestInventoryForUser(userID, userInfo.FolderReceive, userInfo.ItemReceive); 204 this.m_parent.InventoryService.RequestInventoryForUser(userID, userInfo.FolderReceive, userInfo.ItemReceive);
185 } 205 }
186 206
187 /// <summary> 207 /// <summary>
@@ -221,3 +241,7 @@ namespace OpenSim.Framework.Communications.Caches
221 } 241 }
222} 242}
223 243
244
245
246
247
diff --git a/OpenSim/Framework/Communications/IInventoryServices.cs b/OpenSim/Framework/Communications/IInventoryServices.cs
index 80c2e64..7b2948f 100644
--- a/OpenSim/Framework/Communications/IInventoryServices.cs
+++ b/OpenSim/Framework/Communications/IInventoryServices.cs
@@ -1,29 +1,31 @@
1using System; 1using System;
2using System.Collections.Generic;
3using System.Text; 2using System.Text;
4using OpenSim.Framework.Data; 3using System.Collections.Generic;
4
5using libsecondlife; 5using libsecondlife;
6using OpenSim.Framework.Data;
6using OpenSim.Framework.Communications.Caches; 7using OpenSim.Framework.Communications.Caches;
7using InventoryFolder = OpenSim.Framework.Communications.Caches.InventoryFolder;
8 8
9namespace OpenSim.Framework.Communications 9namespace OpenSim.Framework.Communications
10{ 10{
11 public delegate void InventoryFolderInfo(LLUUID userID, InventoryFolder folderInfo); 11 public delegate void InventoryFolderInfo(LLUUID userID, InventoryFolderBase 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, InventoryFolder folder); 17 void AddNewInventoryFolder(LLUUID userID, InventoryFolderBase 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 user); 20 void CreateNewUserInventory(LLUUID libraryRootId, LLUUID user);
21 void GetRootFoldersForUser(LLUUID user, out LLUUID libraryFolder, out LLUUID personalFolder);
21 22
22 /// <summary> 23 /// <summary>
23 /// Returns the root folder plus any folders in root (so down one level in the Inventory folders tree) 24 /// Returns the root folder plus any folders in root (so down one level in the Inventory folders tree)
24 /// </summary> 25 /// </summary>
25 /// <param name="userID"></param> 26 /// <param name="userID"></param>
26 /// <returns></returns> 27 /// <returns></returns>
27 List<InventoryFolderBase> RequestFirstLevelFolders(LLUUID userID); 28 List<InventoryFolderBase> RequestFirstLevelFolders(LLUUID folderID);
29 List<InventoryItemBase> RequestFolderItems(LLUUID folderID);
28 } 30 }
29} 31}
diff --git a/OpenSim/Framework/Communications/InventoryServiceBase.cs b/OpenSim/Framework/Communications/InventoryServiceBase.cs
index da7a0ce..6283b60 100644
--- a/OpenSim/Framework/Communications/InventoryServiceBase.cs
+++ b/OpenSim/Framework/Communications/InventoryServiceBase.cs
@@ -1,4 +1,9 @@
1using System; 1using System;
2using System.Text;
3using System.IO;
4using System.Xml;
5using System.Xml.Serialization;
6using System.Collections;
2using System.Collections.Generic; 7using System.Collections.Generic;
3using System.Reflection; 8using System.Reflection;
4using libsecondlife; 9using libsecondlife;
@@ -6,21 +11,20 @@ using OpenSim.Framework.Communications;
6using OpenSim.Framework.Console; 11using OpenSim.Framework.Console;
7using OpenSim.Framework.Data; 12using OpenSim.Framework.Data;
8using InventoryFolder=OpenSim.Framework.Communications.Caches.InventoryFolder; 13using InventoryFolder=OpenSim.Framework.Communications.Caches.InventoryFolder;
14using InventoryCategory = OpenSim.Framework.Data.InventoryCategory;
9 15
10namespace OpenSim.Framework.Communications 16namespace OpenSim.Framework.Communications
11{ 17{
12 public abstract class InventoryServiceBase : IInventoryServices 18 public abstract class InventoryServiceBase : MarshalByRefObject, IInventoryServices
13 { 19 {
14 protected Dictionary<string, IInventoryData> m_plugins = new Dictionary<string, IInventoryData>(); 20 protected IInventoryData _databasePlugin;
15 //protected IAssetServer m_assetServer;
16 21
17 public InventoryServiceBase() 22 public InventoryServiceBase()
18 { 23 {
19 //m_assetServer = assetServer;
20 } 24 }
21 25
22 /// <summary> 26 /// <summary>
23 /// Adds a new user server plugin - plugins will be requested in the order they were loaded. 27 /// Adds a new inventory data server plugin
24 /// </summary> 28 /// </summary>
25 /// <param name="FileName">The filename to the user server plugin DLL</param> 29 /// <param name="FileName">The filename to the user server plugin DLL</param>
26 public void AddPlugin(string FileName) 30 public void AddPlugin(string FileName)
@@ -41,8 +45,13 @@ namespace OpenSim.Framework.Communications
41 IInventoryData plug = 45 IInventoryData plug =
42 (IInventoryData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); 46 (IInventoryData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
43 plug.Initialise(); 47 plug.Initialise();
44 this.m_plugins.Add(plug.getName(), plug); 48 this._databasePlugin = 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");
45 MainLog.Instance.Verbose("Inventorystorage: Added IInventoryData Interface"); 53 MainLog.Instance.Verbose("Inventorystorage: Added IInventoryData Interface");
54 break;
46 } 55 }
47 } 56 }
48 } 57 }
@@ -54,20 +63,20 @@ namespace OpenSim.Framework.Communications
54 /// </summary> 63 /// </summary>
55 /// <param name="userID"></param> 64 /// <param name="userID"></param>
56 /// <returns></returns> 65 /// <returns></returns>
57 public List<InventoryFolderBase> RequestFirstLevelFolders(LLUUID userID) 66 public List<InventoryFolderBase> RequestFirstLevelFolders(LLUUID folderID)
58 { 67 {
59 List<InventoryFolderBase> inventoryList = new List<InventoryFolderBase>(); 68 InventoryFolderBase root = _databasePlugin.getInventoryFolder(folderID);
60 foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins) 69
70 List<InventoryFolderBase> folders = new List<InventoryFolderBase>();
71 if (root != null)
61 { 72 {
62 InventoryFolderBase rootFolder = plugin.Value.getUserRootFolder(userID); 73 folders.Add(root);
63 if (rootFolder != null) 74
64 { 75 List<InventoryFolderBase> subFolders = _databasePlugin.getInventoryFolders(root.folderID);
65 inventoryList = plugin.Value.getInventoryFolders(rootFolder.folderID); 76 foreach (InventoryFolderBase f in subFolders)
66 inventoryList.Insert(0, rootFolder); 77 folders.Add(f);
67 return inventoryList;
68 }
69 } 78 }
70 return inventoryList; 79 return folders;
71 } 80 }
72 81
73 /// <summary> 82 /// <summary>
@@ -75,11 +84,7 @@ namespace OpenSim.Framework.Communications
75 /// </summary> 84 /// </summary>
76 public InventoryFolderBase RequestUsersRoot(LLUUID userID) 85 public InventoryFolderBase RequestUsersRoot(LLUUID userID)
77 { 86 {
78 foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins) 87 return _databasePlugin.getInventoryFolder(userID); // the id of the root folder, is the user id
79 {
80 return plugin.Value.getUserRootFolder(userID);
81 }
82 return null;
83 } 88 }
84 89
85 /// <summary> 90 /// <summary>
@@ -89,47 +94,27 @@ namespace OpenSim.Framework.Communications
89 /// <returns></returns> 94 /// <returns></returns>
90 public List<InventoryFolderBase> RequestSubFolders(LLUUID parentFolderID) 95 public List<InventoryFolderBase> RequestSubFolders(LLUUID parentFolderID)
91 { 96 {
92 List<InventoryFolderBase> inventoryList = new List<InventoryFolderBase>(); 97 return _databasePlugin.getInventoryFolders(parentFolderID);
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 List<InventoryItemBase> itemsList = new List<InventoryItemBase>(); 102 return _databasePlugin.getInventoryInFolder(folderID);
103 foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins)
104 {
105 itemsList = plugin.Value.getInventoryInFolder(folderID);
106 return itemsList;
107 }
108 return itemsList;
109 } 103 }
110 104
111 public void AddFolder(InventoryFolderBase folder) 105 public void AddFolder(InventoryFolderBase folder)
112 { 106 {
113 foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins) 107 _databasePlugin.addInventoryFolder(folder);
114 {
115 plugin.Value.addInventoryFolder(folder);
116 }
117 } 108 }
118 109
119 public void AddItem(InventoryItemBase item) 110 public void AddItem(InventoryItemBase item)
120 { 111 {
121 foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins) 112 _databasePlugin.addInventoryItem(item);
122 {
123 plugin.Value.addInventoryItem(item);
124 }
125 } 113 }
126 114
127 public void deleteItem(InventoryItemBase item) 115 public void deleteItem(InventoryItemBase item)
128 { 116 {
129 foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins) 117 _databasePlugin.deleteInventoryItem(item);
130 {
131 plugin.Value.deleteInventoryItem(item);
132 }
133 } 118 }
134 119
135 /// <summary> 120 /// <summary>
@@ -144,11 +129,53 @@ namespace OpenSim.Framework.Communications
144 } 129 }
145 } 130 }
146 131
147 public void CreateNewUserInventory(LLUUID user) 132 public void CreateNewUserInventory(LLUUID defaultFolders, LLUUID user)
148 { 133 {
149 UsersInventory inven = new UsersInventory(); 134 try
150 inven.CreateNewInventorySet(user); 135 {
151 this.AddNewInventorySet(inven); 136 // Get Default folder set from the database
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 }
152 } 179 }
153 180
154 public class UsersInventory 181 public class UsersInventory
@@ -166,10 +193,11 @@ namespace OpenSim.Framework.Communications
166 InventoryFolderBase folder = new InventoryFolderBase(); 193 InventoryFolderBase folder = new InventoryFolderBase();
167 folder.parentID = LLUUID.Zero; 194 folder.parentID = LLUUID.Zero;
168 folder.agentID = user; 195 folder.agentID = user;
169 folder.folderID = LLUUID.Random(); 196 folder.folderID = user; // id of root folder is the same as the agent id
170 folder.name = "My Inventory"; 197 folder.name = "My Inventory";
171 folder.type = 8; 198 folder.type = 8;
172 folder.version = 1; 199 folder.version = 1;
200 folder.category = InventoryCategory.User;
173 Folders.Add(folder.folderID, folder); 201 Folders.Add(folder.folderID, folder);
174 202
175 LLUUID rootFolder = folder.folderID; 203 LLUUID rootFolder = folder.folderID;
@@ -181,6 +209,7 @@ namespace OpenSim.Framework.Communications
181 folder.name = "Textures"; 209 folder.name = "Textures";
182 folder.type = 0; 210 folder.type = 0;
183 folder.version = 1; 211 folder.version = 1;
212 folder.category = InventoryCategory.User;
184 Folders.Add(folder.folderID, folder); 213 Folders.Add(folder.folderID, folder);
185 214
186 folder = new InventoryFolderBase(); 215 folder = new InventoryFolderBase();
@@ -190,6 +219,7 @@ namespace OpenSim.Framework.Communications
190 folder.name = "Objects"; 219 folder.name = "Objects";
191 folder.type = 6; 220 folder.type = 6;
192 folder.version = 1; 221 folder.version = 1;
222 folder.category = InventoryCategory.User;
193 Folders.Add(folder.folderID, folder); 223 Folders.Add(folder.folderID, folder);
194 224
195 folder = new InventoryFolderBase(); 225 folder = new InventoryFolderBase();
@@ -199,13 +229,130 @@ namespace OpenSim.Framework.Communications
199 folder.name = "Clothes"; 229 folder.name = "Clothes";
200 folder.type = 5; 230 folder.type = 5;
201 folder.version = 1; 231 folder.version = 1;
232 folder.category = InventoryCategory.User;
202 Folders.Add(folder.folderID, folder); 233 Folders.Add(folder.folderID, folder);
203 } 234 }
204 } 235 }
205 236
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
206 public abstract void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack, InventoryItemInfo itemCallBack); 353 public abstract void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack, InventoryItemInfo itemCallBack);
207 public abstract void AddNewInventoryFolder(LLUUID userID, InventoryFolder folder); 354 public abstract void AddNewInventoryFolder(LLUUID userID, InventoryFolderBase folder);
208 public abstract void AddNewInventoryItem(LLUUID userID, InventoryItemBase item); 355 public abstract void AddNewInventoryItem(LLUUID userID, InventoryItemBase item);
209 public abstract void DeleteInventoryItem(LLUUID userID, InventoryItemBase item); 356 public abstract void DeleteInventoryItem(LLUUID userID, InventoryItemBase item);
210 } 357 }
211} \ No newline at end of file 358}
diff --git a/OpenSim/Framework/Communications/LoginResponse.cs b/OpenSim/Framework/Communications/LoginResponse.cs
index b5a4184..b4280e7 100644
--- a/OpenSim/Framework/Communications/LoginResponse.cs
+++ b/OpenSim/Framework/Communications/LoginResponse.cs
@@ -26,9 +26,10 @@ 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 agentInventory; 29 private ArrayList inventorySkeleton;
30 private ArrayList inventoryLibraryOwner; 30 private ArrayList inventoryLibraryOwner;
31 private ArrayList inventoryLibrary; 31 private ArrayList inventoryLibraryRoot;
32 private ArrayList inventoryLibrarySkeleton;
32 33
33 private UserInfo userProfile; 34 private UserInfo userProfile;
34 35
@@ -86,11 +87,13 @@ namespace OpenSim.Framework.UserManagement
86 87
87 this.defaultXmlRpcResponse = new XmlRpcResponse(); 88 this.defaultXmlRpcResponse = new XmlRpcResponse();
88 this.userProfile = new UserInfo(); 89 this.userProfile = new UserInfo();
89 this.inventoryRoot = new ArrayList(); 90
90 this.initialOutfit = new ArrayList(); 91 this.initialOutfit = new ArrayList();
91 this.agentInventory = new ArrayList(); 92 this.inventoryRoot = new ArrayList();
92 this.inventoryLibrary = new ArrayList(); 93 this.inventorySkeleton = new ArrayList();
94 this.inventoryLibrarySkeleton = new ArrayList();
93 this.inventoryLibraryOwner = new ArrayList(); 95 this.inventoryLibraryOwner = new ArrayList();
96 this.inventoryLibraryRoot = new ArrayList();
94 97
95 this.xmlRpcResponse = new XmlRpcResponse(); 98 this.xmlRpcResponse = new XmlRpcResponse();
96 this.defaultXmlRpcResponse = new XmlRpcResponse(); 99 this.defaultXmlRpcResponse = new XmlRpcResponse();
@@ -237,12 +240,15 @@ namespace OpenSim.Framework.UserManagement
237 responseData["classified_categories"] = this.classifiedCategories; 240 responseData["classified_categories"] = this.classifiedCategories;
238 responseData["ui-config"] = this.uiConfig; 241 responseData["ui-config"] = this.uiConfig;
239 242
240 responseData["inventory-skeleton"] = this.agentInventory; 243 responseData["inventory-skeleton"] = this.inventorySkeleton;
241 responseData["inventory-skel-lib"] = this.inventoryLibrary; 244 responseData["inventory-skel-lib"] = this.inventoryLibrarySkeleton;
242 responseData["inventory-root"] = this.inventoryRoot; 245 responseData["inventory-root"] = this.inventoryRoot;
243 responseData["gestures"] = new ArrayList(); // todo
244 responseData["inventory-lib-owner"] = this.inventoryLibraryOwner; 246 responseData["inventory-lib-owner"] = this.inventoryLibraryOwner;
247 responseData["inventory-lib-root"] = this.inventoryLibraryRoot;
248
249 responseData["gestures"] = new ArrayList(); // todo
245 responseData["initial-outfit"] = this.initialOutfit; 250 responseData["initial-outfit"] = this.initialOutfit;
251
246 responseData["start_location"] = this.startLocation; 252 responseData["start_location"] = this.startLocation;
247 responseData["seed_capability"] = this.seedCapability; 253 responseData["seed_capability"] = this.seedCapability;
248 responseData["home"] = this.home; 254 responseData["home"] = this.home;
@@ -596,23 +602,23 @@ namespace OpenSim.Framework.UserManagement
596 { 602 {
597 get 603 get
598 { 604 {
599 return this.agentInventory; 605 return this.inventorySkeleton;
600 } 606 }
601 set 607 set
602 { 608 {
603 this.agentInventory = value; 609 this.inventorySkeleton = value;
604 } 610 }
605 } 611 }
606 612
607 public ArrayList InventoryLibrary 613 public ArrayList InventoryLibrarySkeleton
608 { 614 {
609 get 615 get
610 { 616 {
611 return this.inventoryLibrary; 617 return this.inventoryLibrarySkeleton;
612 } 618 }
613 set 619 set
614 { 620 {
615 this.inventoryLibrary = value; 621 this.inventoryLibrarySkeleton = value;
616 } 622 }
617 } 623 }
618 624
@@ -628,6 +634,18 @@ namespace OpenSim.Framework.UserManagement
628 } 634 }
629 } 635 }
630 636
637 public ArrayList InventoryLibraryRoot
638 {
639 get
640 {
641 return this.inventoryLibraryRoot;
642 }
643 set
644 {
645 this.inventoryLibraryRoot = value;
646 }
647 }
648
631 public string Home 649 public string Home
632 { 650 {
633 get 651 get
@@ -665,3 +683,7 @@ namespace OpenSim.Framework.UserManagement
665 } 683 }
666} 684}
667 685
686
687
688
689
diff --git a/OpenSim/Framework/Communications/LoginService.cs b/OpenSim/Framework/Communications/LoginService.cs
index 8e7cf80..64e323d 100644
--- a/OpenSim/Framework/Communications/LoginService.cs
+++ b/OpenSim/Framework/Communications/LoginService.cs
@@ -8,11 +8,10 @@ using Nwc.XmlRpc;
8using OpenSim.Framework.Console; 8using OpenSim.Framework.Console;
9using OpenSim.Framework.Data; 9using OpenSim.Framework.Data;
10using OpenSim.Framework.Interfaces; 10using OpenSim.Framework.Interfaces;
11using OpenSim.Framework.Inventory;
12using OpenSim.Framework.Utilities; 11using OpenSim.Framework.Utilities;
13 12using OpenSim.Framework.Communications;
14using OpenSim.Framework.Configuration; 13using OpenSim.Framework.Configuration;
15using InventoryFolder = OpenSim.Framework.Inventory.InventoryFolder; 14
16 15
17namespace OpenSim.Framework.UserManagement 16namespace OpenSim.Framework.UserManagement
18{ 17{
@@ -20,10 +19,12 @@ namespace OpenSim.Framework.UserManagement
20 { 19 {
21 protected string m_welcomeMessage = "Welcome to OpenSim"; 20 protected string m_welcomeMessage = "Welcome to OpenSim";
22 protected UserManagerBase m_userManager = null; 21 protected UserManagerBase m_userManager = null;
22 protected IInventoryServices m_inventoryServer = null;
23 23
24 public LoginService(UserManagerBase userManager, string welcomeMess) 24 public LoginService(UserManagerBase userManager, IInventoryServices inventoryServer, string welcomeMess)
25 { 25 {
26 m_userManager = userManager; 26 m_userManager = userManager;
27 m_inventoryServer = inventoryServer;
27 if (welcomeMess != "") 28 if (welcomeMess != "")
28 { 29 {
29 m_welcomeMessage = welcomeMess; 30 m_welcomeMessage = welcomeMess;
@@ -37,7 +38,6 @@ namespace OpenSim.Framework.UserManagement
37 /// <returns>The response to send</returns> 38 /// <returns>The response to send</returns>
38 public XmlRpcResponse XmlRpcLoginMethod(XmlRpcRequest request) 39 public XmlRpcResponse XmlRpcLoginMethod(XmlRpcRequest request)
39 { 40 {
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,15 +85,41 @@ namespace OpenSim.Framework.UserManagement
85 { 85 {
86 LLUUID agentID = userProfile.UUID; 86 LLUUID agentID = userProfile.UUID;
87 87
88 // Inventory Library Section 88 LLUUID libraryFolderID;
89 InventoryData inventData = this.CreateInventoryData(agentID); 89 LLUUID personalFolderID;
90 ArrayList AgentInventoryArray = inventData.InventoryArray; 90
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);
91 109
92 Hashtable InventoryRootHash = new Hashtable(); 110 // The option "inventory-root" requires that we return the id of the
93 InventoryRootHash["folder_id"] = inventData.RootFolderID.ToStringHyphenated(); 111 // root folder of the users inventory.
94 ArrayList InventoryRoot = new ArrayList(); 112 dynamicStruct = new Hashtable();
95 InventoryRoot.Add(InventoryRootHash); 113 dynamicStruct["folder_id"] = personalFolderID.ToStringHyphenated();
96 userProfile.rootInventoryFolderID = inventData.RootFolderID; 114 logResponse.InventoryRoot.Add(dynamicStruct);
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);
97 123
98 // Circuit Code 124 // Circuit Code
99 uint circode = (uint)(Util.RandomClass.Next()); 125 uint circode = (uint)(Util.RandomClass.Next());
@@ -103,10 +129,6 @@ namespace OpenSim.Framework.UserManagement
103 logResponse.AgentID = agentID.ToStringHyphenated(); 129 logResponse.AgentID = agentID.ToStringHyphenated();
104 logResponse.SessionID = userProfile.currentAgent.sessionID.ToStringHyphenated(); 130 logResponse.SessionID = userProfile.currentAgent.sessionID.ToStringHyphenated();
105 logResponse.SecureSessionID = userProfile.currentAgent.secureSessionID.ToStringHyphenated(); 131 logResponse.SecureSessionID = userProfile.currentAgent.secureSessionID.ToStringHyphenated();
106 logResponse.InventoryRoot = InventoryRoot;
107 logResponse.InventorySkeleton = AgentInventoryArray;
108 logResponse.InventoryLibrary = this.GetInventoryLibrary();
109 logResponse.InventoryLibraryOwner = this.GetLibraryOwner();
110 logResponse.CircuitCode = (Int32)circode; 132 logResponse.CircuitCode = (Int32)circode;
111 //logResponse.RegionX = 0; //overwritten 133 //logResponse.RegionX = 0; //overwritten
112 //logResponse.RegionY = 0; //overwritten 134 //logResponse.RegionY = 0; //overwritten
@@ -212,76 +234,30 @@ namespace OpenSim.Framework.UserManagement
212 } 234 }
213 235
214 /// <summary> 236 /// <summary>
215 /// 237 /// Create a structure of the generic inventory structure of a specified folder
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 ///
242 /// </summary> 238 /// </summary>
243 /// <returns></returns> 239 /// <returns></returns>
244 protected virtual ArrayList GetLibraryOwner() 240 protected virtual ArrayList GetInventorySkeleton(LLUUID folderID)
245 { 241 {
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 }
253 242
254 protected virtual InventoryData CreateInventoryData(LLUUID userID) 243 List<InventoryFolderBase> folders = m_inventoryServer.RequestFirstLevelFolders(folderID);
255 {
256 AgentInventory userInventory = new AgentInventory();
257 userInventory.CreateRootFolder(userID, false);
258 244
259 ArrayList AgentInventoryArray = new ArrayList(); 245 ArrayList temp = new ArrayList();
260 Hashtable TempHash; 246 foreach (InventoryFolderBase ifb in folders)
261 foreach (InventoryFolder InvFolder in userInventory.InventoryFolders.Values)
262 { 247 {
263 TempHash = new Hashtable(); 248 LLUUID tempFolderID = ifb.folderID;
264 TempHash["name"] = InvFolder.FolderName; 249 LLUUID tempParentID = ifb.parentID;
265 TempHash["parent_id"] = InvFolder.ParentID.ToStringHyphenated(); 250
266 TempHash["version"] = (Int32)InvFolder.Version; 251 Hashtable TempHash = new Hashtable();
267 TempHash["type_default"] = (Int32)InvFolder.DefaultType; 252 TempHash["folder_id"] = tempFolderID.ToStringHyphenated();
268 TempHash["folder_id"] = InvFolder.FolderID.ToStringHyphenated(); 253 TempHash["name"] = ifb.name;
269 AgentInventoryArray.Add(TempHash); 254 TempHash["parent_id"] = tempParentID.ToStringHyphenated();
255 TempHash["type_default"] = ifb.type;
256 TempHash["version"] = ifb.version+1;
257 temp.Add(TempHash);
270 } 258 }
271 259
272 return new InventoryData(AgentInventoryArray, userInventory.InventoryRoot.FolderID); 260 return temp;
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 }
285 } 261 }
286 } 262 }
287} 263}
diff --git a/OpenSim/Framework/Data.MySQL/MySQLInventoryData.cs b/OpenSim/Framework/Data.MySQL/MySQLInventoryData.cs
index 5009d9e..8a7e869 100644
--- a/OpenSim/Framework/Data.MySQL/MySQLInventoryData.cs
+++ b/OpenSim/Framework/Data.MySQL/MySQLInventoryData.cs
@@ -132,7 +132,7 @@ namespace OpenSim.Framework.Data.MySQL
132 param["?uuid"] = user.ToStringHyphenated(); 132 param["?uuid"] = user.ToStringHyphenated();
133 param["?zero"] = LLUUID.Zero.ToStringHyphenated(); 133 param["?zero"] = LLUUID.Zero.ToStringHyphenated();
134 134
135 IDbCommand result = database.Query("SELECT * FROM inventoryfolders WHERE parentFolderID = ?zero AND agentID = ?uuid", param); 135 IDbCommand result = database.Query("SELECT * FROM inventoryfolders WHERE parentFolderID = ?zero AND (agentID = ?uuid OR category = 0)", param);
136 IDataReader reader = result.ExecuteReader(); 136 IDataReader reader = result.ExecuteReader();
137 137
138 List<InventoryFolderBase> items = database.readInventoryFolders(reader); 138 List<InventoryFolderBase> items = database.readInventoryFolders(reader);
@@ -152,40 +152,6 @@ namespace OpenSim.Framework.Data.MySQL
152 } 152 }
153 153
154 /// <summary> 154 /// <summary>
155 /// Returns the users inventory root folder.
156 /// </summary>
157 /// <param name="user"></param>
158 /// <returns></returns>
159 public InventoryFolderBase getUserRootFolder(LLUUID user)
160 {
161 try
162 {
163 lock (database)
164 {
165 Dictionary<string, string> param = new Dictionary<string, string>();
166 param["?uuid"] = user.ToStringHyphenated();
167 param["?zero"] = LLUUID.Zero.ToStringHyphenated();
168
169 IDbCommand result = database.Query("SELECT * FROM inventoryfolders WHERE parentFolderID = ?zero AND agentID = ?uuid", param);
170 IDataReader reader = result.ExecuteReader();
171
172 List<InventoryFolderBase> items = database.readInventoryFolders(reader);
173 InventoryFolderBase rootFolder = items[0]; //should only be one folder with parent set to zero (the root one).
174 reader.Close();
175 result.Dispose();
176
177 return rootFolder;
178 }
179 }
180 catch (Exception e)
181 {
182 database.Reconnect();
183 Console.WriteLine(e.ToString());
184 return null;
185 }
186 }
187
188 /// <summary>
189 /// Returns a list of folders in a users inventory contained within the specified folder 155 /// Returns a list of folders in a users inventory contained within the specified folder
190 /// </summary> 156 /// </summary>
191 /// <param name="parentID">The folder to search</param> 157 /// <param name="parentID">The folder to search</param>
@@ -348,5 +314,27 @@ namespace OpenSim.Framework.Data.MySQL
348 { 314 {
349 addInventoryFolder(folder); 315 addInventoryFolder(folder);
350 } 316 }
317
318 public void deleteInventoryCategory(InventoryCategory inventoryCategory)
319 {
320 try
321 {
322 lock (database) {
323 IDbCommand cmd = database.Query(string.Format("DELETE FROM inventoryitems WHERE parentFolderID IN (SELECT folderId FROM inventoryfolders WHERE category={0})", (byte)inventoryCategory), null);
324 cmd.ExecuteNonQuery();
325
326
327 cmd = database.Query(string.Format("DELETE FROM inventoryfolders WHERE category={0}", (byte)inventoryCategory), null);
328 cmd.ExecuteNonQuery();
329 }
330
331 }
332 catch (Exception e)
333 {
334 database.Reconnect();
335 Console.WriteLine(e.ToString());
336 }
337 }
338
351 } 339 }
352} 340}
diff --git a/OpenSim/Framework/Data.MySQL/MySQLManager.cs b/OpenSim/Framework/Data.MySQL/MySQLManager.cs
index 5037f98..e55606e 100644
--- a/OpenSim/Framework/Data.MySQL/MySQLManager.cs
+++ b/OpenSim/Framework/Data.MySQL/MySQLManager.cs
@@ -41,7 +41,7 @@ namespace OpenSim.Framework.Data.MySQL
41 /// <summary> 41 /// <summary>
42 /// The database connection object 42 /// The database connection object
43 /// </summary> 43 /// </summary>
44 IDbConnection dbcon; 44 MySqlConnection dbcon;
45 /// <summary> 45 /// <summary>
46 /// Connection string for ADO.net 46 /// Connection string for ADO.net
47 /// </summary> 47 /// </summary>
@@ -115,10 +115,11 @@ namespace OpenSim.Framework.Data.MySQL
115 { 115 {
116 MySqlCommand dbcommand = (MySqlCommand)dbcon.CreateCommand(); 116 MySqlCommand dbcommand = (MySqlCommand)dbcon.CreateCommand();
117 dbcommand.CommandText = sql; 117 dbcommand.CommandText = sql;
118 foreach (KeyValuePair<string, string> param in parameters) 118 if(parameters != null)
119 { 119 foreach (KeyValuePair<string, string> param in parameters)
120 dbcommand.Parameters.Add(param.Key, param.Value); 120 {
121 } 121 dbcommand.Parameters.Add(param.Key, param.Value);
122 }
122 123
123 return (IDbCommand)dbcommand; 124 return (IDbCommand)dbcommand;
124 } 125 }
@@ -149,10 +150,11 @@ namespace OpenSim.Framework.Data.MySQL
149 { 150 {
150 MySqlCommand dbcommand = (MySqlCommand)dbcon.CreateCommand(); 151 MySqlCommand dbcommand = (MySqlCommand)dbcon.CreateCommand();
151 dbcommand.CommandText = sql; 152 dbcommand.CommandText = sql;
152 foreach (KeyValuePair<string, string> param in parameters) 153 if(parameters != null)
153 { 154 foreach (KeyValuePair<string, string> param in parameters)
154 dbcommand.Parameters.Add(param.Key, param.Value); 155 {
155 } 156 dbcommand.Parameters.Add(param.Key, param.Value);
157 }
156 158
157 return (IDbCommand)dbcommand; 159 return (IDbCommand)dbcommand;
158 } 160 }
@@ -370,6 +372,8 @@ namespace OpenSim.Framework.Data.MySQL
370 folder.parentID = new LLUUID((string)reader["parentFolderID"]); 372 folder.parentID = new LLUUID((string)reader["parentFolderID"]);
371 folder.folderID = new LLUUID((string)reader["folderID"]); 373 folder.folderID = new LLUUID((string)reader["folderID"]);
372 folder.name = (string)reader["folderName"]; 374 folder.name = (string)reader["folderName"];
375 folder.category = (InventoryCategory)((Int16)reader["category"]);
376 folder.type = (Int16)reader["folderType"];
373 377
374 rows.Add(folder); 378 rows.Add(folder);
375 } 379 }
@@ -509,24 +513,32 @@ namespace OpenSim.Framework.Data.MySQL
509 /// <returns>Success?</returns> 513 /// <returns>Success?</returns>
510 public bool insertFolder(InventoryFolderBase folder) 514 public bool insertFolder(InventoryFolderBase folder)
511 { 515 {
512 string sql = "REPLACE INTO inventoryfolders (folderID, agentID, parentFolderID, folderName) VALUES "; 516 string sql = "REPLACE INTO inventoryfolders (folderID, agentID, parentFolderID, folderName, category, folderType) VALUES ";
513 sql += "(?folderID, ?agentID, ?parentFolderID, ?folderName)"; 517 sql += "(?folderID, ?agentID, ?parentFolderID, ?folderName, ?category, ?folderType)";
514 518
515 Dictionary<string, string> parameters = new Dictionary<string, string>(); 519 MySqlCommand dbcmd = dbcon.CreateCommand();
516 parameters["?folderID"] = folder.folderID.ToStringHyphenated(); 520 dbcmd.CommandText = sql;
517 parameters["?agentID"] = folder.agentID.ToStringHyphenated(); 521
518 parameters["?parentFolderID"] = folder.parentID.ToStringHyphenated(); 522 LLUUID tmpID = folder.folderID;
519 parameters["?folderName"] = folder.name; 523 dbcmd.Parameters.Add(new MySqlParameter("?folderID", tmpID.ToStringHyphenated()));
520 524 dbcmd.Parameters.Add(new MySqlParameter("?folderID", tmpID.ToStringHyphenated()));
525 tmpID = folder.agentID;
526 dbcmd.Parameters.Add(new MySqlParameter("?agentID", tmpID.ToStringHyphenated()));
527 tmpID = folder.parentID;
528 dbcmd.Parameters.Add(new MySqlParameter("?parentFolderID", tmpID.ToStringHyphenated()));
529 dbcmd.Parameters.Add(new MySqlParameter("?folderName", folder.name));
530 MySqlParameter p = dbcmd.Parameters.Add(new MySqlParameter("?category", MySqlDbType.Byte));
531 p.Value = (byte)folder.category;
532
533 p = dbcmd.Parameters.Add(new MySqlParameter("?folderType", MySqlDbType.Byte));
534 p.Value = (byte)folder.type;
535
536
521 bool returnval = false; 537 bool returnval = false;
522 try 538 try
523 { 539 {
524 IDbCommand result = Query(sql, parameters); 540 if (dbcmd.ExecuteNonQuery() == 1)
525
526 if (result.ExecuteNonQuery() == 1)
527 returnval = true; 541 returnval = true;
528
529 result.Dispose();
530 } 542 }
531 catch (Exception e) 543 catch (Exception e)
532 { 544 {
diff --git a/OpenSim/Framework/Data.SQLite/SQLiteInventoryStore.cs b/OpenSim/Framework/Data.SQLite/SQLiteInventoryStore.cs
index d3d752f..cac992c 100644
--- a/OpenSim/Framework/Data.SQLite/SQLiteInventoryStore.cs
+++ b/OpenSim/Framework/Data.SQLite/SQLiteInventoryStore.cs
@@ -61,6 +61,7 @@ namespace OpenSim.Framework.Data.SQLite
61 MainLog.Instance.Verbose("DATASTORE", "Populated Intentory Items Definitions"); 61 MainLog.Instance.Verbose("DATASTORE", "Populated Intentory Items Definitions");
62 62
63 ds.AcceptChanges(); 63 ds.AcceptChanges();
64
64 return; 65 return;
65 } 66 }
66 67
@@ -195,43 +196,16 @@ namespace OpenSim.Framework.Data.SQLite
195 /// <returns>A list of folder objects</returns> 196 /// <returns>A list of folder objects</returns>
196 public List<InventoryFolderBase> getUserRootFolders(LLUUID user) 197 public List<InventoryFolderBase> getUserRootFolders(LLUUID user)
197 { 198 {
198 return null;
199 }
200
201 /// <summary>
202 /// Returns the users inventory root folder.
203 /// </summary>
204 /// <param name="user">The UUID of the user who is having inventory being returned</param>
205 /// <returns>Root inventory folder</returns>
206 public InventoryFolderBase getUserRootFolder(LLUUID user)
207 {
208 List<InventoryFolderBase> folders = new List<InventoryFolderBase>(); 199 List<InventoryFolderBase> folders = new List<InventoryFolderBase>();
209 DataTable inventoryFolderTable = ds.Tables["inventoryfolders"]; 200 DataTable inventoryFolderTable = ds.Tables["inventoryfolders"];
210 string selectExp = "agentID = '" + user.ToString() + "' AND parentID = '" + LLUUID.Zero.ToString() + "'"; 201
202 string selectExp = "parentID = '" + LLUUID.Zero.ToString() + "' AND (agentID = '" + user.ToString() + "' OR category = 0)";
211 DataRow[] rows = inventoryFolderTable.Select(selectExp); 203 DataRow[] rows = inventoryFolderTable.Select(selectExp);
212 foreach (DataRow row in rows) 204 foreach (DataRow row in rows)
213 { 205 {
214 folders.Add(this.buildFolder(row)); 206 folders.Add(this.buildFolder(row));
215 } 207 }
216 208 return folders;
217 if (folders.Count == 1)
218 {
219 //we found the root
220 //System.Console.WriteLine("found root inventory folder");
221 return folders[0];
222 }
223 else if (folders.Count > 1)
224 {
225 //err shouldn't be more than one root
226 //System.Console.WriteLine("found more than one root inventory folder");
227 }
228 else if (folders.Count == 0)
229 {
230 // no root?
231 //System.Console.WriteLine("couldn't find root inventory folder");
232 }
233
234 return null;
235 } 209 }
236 210
237 /// <summary> 211 /// <summary>
@@ -270,7 +244,14 @@ namespace OpenSim.Framework.Data.SQLite
270 /// <returns>A class containing folder information</returns> 244 /// <returns>A class containing folder information</returns>
271 public InventoryFolderBase getInventoryFolder(LLUUID folder) 245 public InventoryFolderBase getInventoryFolder(LLUUID folder)
272 { 246 {
273 return null; 247 DataTable inventoryFolderTable = ds.Tables["inventoryfolders"];
248 string selectExp = "UUID = '" + folder.ToString() + "'";
249 DataRow[] rows = inventoryFolderTable.Select(selectExp);
250
251 if (rows.Length == 1)
252 return this.buildFolder(rows[0]);
253 else
254 return null;
274 } 255 }
275 256
276 /// <summary> 257 /// <summary>
@@ -308,6 +289,11 @@ namespace OpenSim.Framework.Data.SQLite
308 this.invItemsDa.Update(ds, "inventoryitems"); 289 this.invItemsDa.Update(ds, "inventoryitems");
309 } 290 }
310 291
292 //TODO! Implement SQLite deleteInventoryCategory
293 public void deleteInventoryCategory(InventoryCategory inventoryCategory)
294 {
295 }
296
311 /// <summary> 297 /// <summary>
312 /// Adds a new folder specified by folder 298 /// Adds a new folder specified by folder
313 /// </summary> 299 /// </summary>
@@ -326,6 +312,11 @@ namespace OpenSim.Framework.Data.SQLite
326 this.addFolder(folder); 312 this.addFolder(folder);
327 } 313 }
328 314
315 //TODO! implement CreateNewUserInventory
316 public void CreateNewUserInventory(LLUUID user)
317 {
318 throw new Exception("Function not implemented");
319 }
329 320
330 /*********************************************************************** 321 /***********************************************************************
331 * 322 *
@@ -350,6 +341,7 @@ namespace OpenSim.Framework.Data.SQLite
350 createCol(inv, "parentFolderID", typeof(System.String)); 341 createCol(inv, "parentFolderID", typeof(System.String));
351 createCol(inv, "avatarID", typeof(System.String)); 342 createCol(inv, "avatarID", typeof(System.String));
352 createCol(inv, "creatorsID", typeof(System.String)); 343 createCol(inv, "creatorsID", typeof(System.String));
344 createCol(inv, "category", typeof(System.Byte));
353 345
354 createCol(inv, "inventoryName", typeof(System.String)); 346 createCol(inv, "inventoryName", typeof(System.String));
355 createCol(inv, "inventoryDescription", typeof(System.String)); 347 createCol(inv, "inventoryDescription", typeof(System.String));
@@ -373,6 +365,7 @@ namespace OpenSim.Framework.Data.SQLite
373 createCol(fol, "parentID", typeof(System.String)); 365 createCol(fol, "parentID", typeof(System.String));
374 createCol(fol, "type", typeof(System.Int32)); 366 createCol(fol, "type", typeof(System.Int32));
375 createCol(fol, "version", typeof(System.Int32)); 367 createCol(fol, "version", typeof(System.Int32));
368 createCol(fol, "category", typeof(System.Byte));
376 369
377 fol.PrimaryKey = new DataColumn[] { fol.Columns["UUID"] }; 370 fol.PrimaryKey = new DataColumn[] { fol.Columns["UUID"] };
378 return fol; 371 return fol;
@@ -415,6 +408,7 @@ namespace OpenSim.Framework.Data.SQLite
415 folder.parentID = new LLUUID((string)row["parentID"]); 408 folder.parentID = new LLUUID((string)row["parentID"]);
416 folder.type = Convert.ToInt16(row["type"]); 409 folder.type = Convert.ToInt16(row["type"]);
417 folder.version = Convert.ToUInt16(row["version"]); 410 folder.version = Convert.ToUInt16(row["version"]);
411 folder.category = (InventoryCategory)Convert.ToByte(row["category"]);
418 return folder; 412 return folder;
419 } 413 }
420 414
@@ -426,6 +420,7 @@ namespace OpenSim.Framework.Data.SQLite
426 row["parentID"] = folder.parentID; 420 row["parentID"] = folder.parentID;
427 row["type"] = folder.type; 421 row["type"] = folder.type;
428 row["version"] = folder.version; 422 row["version"] = folder.version;
423 row["category"] = folder.category;
429 } 424 }
430 425
431 426
@@ -644,3 +639,7 @@ namespace OpenSim.Framework.Data.SQLite
644 } 639 }
645} 640}
646 641
642
643
644
645
diff --git a/OpenSim/Framework/Data/InventoryData.cs b/OpenSim/Framework/Data/InventoryData.cs
index 2df26e1..dc857d8 100644
--- a/OpenSim/Framework/Data/InventoryData.cs
+++ b/OpenSim/Framework/Data/InventoryData.cs
@@ -25,15 +25,19 @@
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System;
29using System.Xml.Serialization;
28using System.Collections.Generic; 30using System.Collections.Generic;
29using libsecondlife; 31using libsecondlife;
30 32
31namespace OpenSim.Framework.Data 33namespace OpenSim.Framework.Data
32{ 34{
35
36 public enum InventoryCategory : byte { Library, Default, User };
33 /// <summary> 37 /// <summary>
34 /// Inventory Item - contains all the properties associated with an individual inventory piece. 38 /// Inventory Item - contains all the properties associated with an individual inventory piece.
35 /// </summary> 39 /// </summary>
36 public class InventoryItemBase 40 public class InventoryItemBase : MarshalByRefObject
37 { 41 {
38 /// <summary> 42 /// <summary>
39 /// A UUID containing the ID for the inventory item itself 43 /// A UUID containing the ID for the inventory item itself
@@ -66,10 +70,12 @@ namespace OpenSim.Framework.Data
66 /// <summary> 70 /// <summary>
67 /// The name of the inventory item (must be less than 64 characters) 71 /// The name of the inventory item (must be less than 64 characters)
68 /// </summary> 72 /// </summary>
73 [XmlElement(ElementName="name")]
69 public string inventoryName; 74 public string inventoryName;
70 /// <summary> 75 /// <summary>
71 /// The description of the inventory item (must be less than 64 characters) 76 /// The description of the inventory item (must be less than 64 characters)
72 /// </summary> 77 /// </summary>
78 [XmlElement(ElementName = "description")]
73 public string inventoryDescription; 79 public string inventoryDescription;
74 /// <summary> 80 /// <summary>
75 /// A mask containing the permissions for the next owner (cannot be enforced) 81 /// A mask containing the permissions for the next owner (cannot be enforced)
@@ -92,7 +98,7 @@ namespace OpenSim.Framework.Data
92 /// <summary> 98 /// <summary>
93 /// A Class for folders which contain users inventory 99 /// A Class for folders which contain users inventory
94 /// </summary> 100 /// </summary>
95 public class InventoryFolderBase 101 public class InventoryFolderBase : MarshalByRefObject
96 { 102 {
97 /// <summary> 103 /// <summary>
98 /// The name of the folder (64 characters or less) 104 /// The name of the folder (64 characters or less)
@@ -118,6 +124,10 @@ namespace OpenSim.Framework.Data
118 /// 124 ///
119 /// </summary> 125 /// </summary>
120 public ushort version; 126 public ushort version;
127 /// <summary>
128 /// Inventory category, Library, Default, System
129 /// </summary>
130 public InventoryCategory category;
121 } 131 }
122 132
123 /// <summary> 133 /// <summary>
@@ -162,13 +172,6 @@ namespace OpenSim.Framework.Data
162 List<InventoryFolderBase> getUserRootFolders(LLUUID user); 172 List<InventoryFolderBase> getUserRootFolders(LLUUID user);
163 173
164 /// <summary> 174 /// <summary>
165 /// Returns the users inventory root folder.
166 /// </summary>
167 /// <param name="user">The UUID of the user who is having inventory being returned</param>
168 /// <returns>Root inventory folder</returns>
169 InventoryFolderBase getUserRootFolder(LLUUID user);
170
171 /// <summary>
172 /// Returns a list of inventory folders contained in the folder 'parentID' 175 /// Returns a list of inventory folders contained in the folder 'parentID'
173 /// </summary> 176 /// </summary>
174 /// <param name="parentID">The folder to get subfolders for</param> 177 /// <param name="parentID">The folder to get subfolders for</param>
@@ -218,5 +221,17 @@ namespace OpenSim.Framework.Data
218 /// </summary> 221 /// </summary>
219 /// <param name="folder">The inventory folder</param> 222 /// <param name="folder">The inventory folder</param>
220 void updateInventoryFolder(InventoryFolderBase folder); 223 void updateInventoryFolder(InventoryFolderBase folder);
224
225 /// <summary>
226 /// Delete a complete inventory category
227 /// </summary>
228 /// <param name="inventoryCategory">What folder category shout be deleted</param>
229 void deleteInventoryCategory(InventoryCategory inventoryCategory);
230
231 /// <summary>
232 /// Setup the initial folderset of a user
233 /// </summary>
234 /// <param name="user"></param>
235 //void CreateNewUserInventory(LLUUID user);
221 } 236 }
222} 237}
diff --git a/OpenSim/Framework/General/Configuration/InventoryConfig.cs b/OpenSim/Framework/General/Configuration/InventoryConfig.cs
new file mode 100644
index 0000000..d84609b
--- /dev/null
+++ b/OpenSim/Framework/General/Configuration/InventoryConfig.cs
@@ -0,0 +1,67 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4
5namespace OpenSim.Framework.Configuration
6{
7 /// <summary>
8 /// UserConfig -- For User Server Configuration
9 /// </summary>
10 public class InventoryConfig
11 {
12 public string DefaultStartupMsg = "";
13 public string UserServerURL = "";
14 public string UserSendKey = "";
15 public string UserRecvKey = "";
16
17 public string DatabaseProvider = "";
18
19 public int RemotingPort = 8004;
20
21 private ConfigurationMember configMember;
22
23 public InventoryConfig(string description, string filename)
24 {
25 configMember = new ConfigurationMember(filename, description, this.loadConfigurationOptions, this.handleIncomingConfiguration);
26 configMember.performConfigurationRetrieve();
27 }
28
29 public void loadConfigurationOptions()
30 {
31 configMember.addConfigurationOption("default_startup_message", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "Default Startup Message", "Welcome to OGS", false);
32 configMember.addConfigurationOption("default_user_server", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "Default User Server URI", "http://127.0.0.1:8002/", false);
33 configMember.addConfigurationOption("user_send_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "Key to send to user server", "null", false);
34 configMember.addConfigurationOption("user_recv_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "Key to expect from user server", "null", false);
35 configMember.addConfigurationOption("database_provider", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "DLL for database provider", "OpenSim.Framework.Data.MySQL.dll", false);
36 configMember.addConfigurationOption("remoting_port", ConfigurationOption.ConfigurationTypes.TYPE_INT32, "Remoting Listener port", "8004", false);
37
38 }
39
40 public bool handleIncomingConfiguration(string configuration_key, object configuration_result)
41 {
42 switch (configuration_key)
43 {
44 case "default_startup_message":
45 this.DefaultStartupMsg = (string)configuration_result;
46 break;
47 case "default_user_server":
48 this.UserServerURL = (string)configuration_result;
49 break;
50 case "user_send_key":
51 this.UserSendKey = (string)configuration_result;
52 break;
53 case "user_recv_key":
54 this.UserRecvKey = (string)configuration_result;
55 break;
56 case "database_provider":
57 this.DatabaseProvider = (string)configuration_result;
58 break;
59 case "remoting_port":
60 RemotingPort = (int)configuration_result;
61 break;
62 }
63
64 return true;
65 }
66 }
67}
diff --git a/OpenSim/Framework/General/Configuration/UserConfig.cs b/OpenSim/Framework/General/Configuration/UserConfig.cs
index 776b911..16a7de4 100644
--- a/OpenSim/Framework/General/Configuration/UserConfig.cs
+++ b/OpenSim/Framework/General/Configuration/UserConfig.cs
@@ -18,6 +18,9 @@ namespace OpenSim.Framework.Configuration
18 18
19 public uint HttpPort = 8002; 19 public uint HttpPort = 8002;
20 20
21 public int InventoryServerPort;
22 public string InventoryServerName;
23
21 private ConfigurationMember configMember; 24 private ConfigurationMember configMember;
22 25
23 public UserConfig(string description, string filename) 26 public UserConfig(string description, string filename)
@@ -37,6 +40,8 @@ namespace OpenSim.Framework.Configuration
37 40
38 configMember.addConfigurationOption("http_port", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, "Http Listener port", "8002", false); 41 configMember.addConfigurationOption("http_port", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, "Http Listener port", "8002", false);
39 42
43 configMember.addConfigurationOption("inventory_server_port", ConfigurationOption.ConfigurationTypes.TYPE_INT32, "Portnumber inventory is listening on", "8004", false);
44 configMember.addConfigurationOption("inventory_server_name", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "DNS name of the inventory server", "127.0.0.1", false);
40 } 45 }
41 46
42 public bool handleIncomingConfiguration(string configuration_key, object configuration_result) 47 public bool handleIncomingConfiguration(string configuration_key, object configuration_result)
@@ -59,6 +64,12 @@ namespace OpenSim.Framework.Configuration
59 this.DatabaseProvider = (string)configuration_result; 64 this.DatabaseProvider = (string)configuration_result;
60 break; 65 break;
61 66
67 case "inventory_server_port":
68 this.InventoryServerPort = (int)configuration_result;
69 break;
70 case "inventory_server_name":
71 this.InventoryServerName = (string)configuration_result;
72 break;
62 case "http_port": 73 case "http_port":
63 HttpPort = (uint)configuration_result; 74 HttpPort = (uint)configuration_result;
64 break; 75 break;
diff --git a/OpenSim/Framework/General/Types/NetworkServersInfo.cs b/OpenSim/Framework/General/Types/NetworkServersInfo.cs
index b65488a..cf194fc 100644
--- a/OpenSim/Framework/General/Types/NetworkServersInfo.cs
+++ b/OpenSim/Framework/General/Types/NetworkServersInfo.cs
@@ -49,6 +49,8 @@ namespace OpenSim.Framework.Types
49 public int HttpListenerPort = 9000; 49 public int HttpListenerPort = 9000;
50 public int RemotingListenerPort = 8895; 50 public int RemotingListenerPort = 8895;
51 51
52 public int InventoryServerPort;
53 public string InventoryServerName = "";
52 54
53 public NetworkServersInfo() 55 public NetworkServersInfo()
54 { 56 {
@@ -86,7 +88,8 @@ namespace OpenSim.Framework.Types
86 UserSendKey = config.Configs["Network"].GetString("user_send_key", "null"); 88 UserSendKey = config.Configs["Network"].GetString("user_send_key", "null");
87 UserRecvKey = config.Configs["Network"].GetString("user_recv_key", "null"); 89 UserRecvKey = config.Configs["Network"].GetString("user_recv_key", "null");
88 AssetURL = config.Configs["Network"].GetString("asset_server_url", "http://127.0.0.1:8003"); 90 AssetURL = config.Configs["Network"].GetString("asset_server_url", "http://127.0.0.1:8003");
89 91 InventoryServerPort = config.Configs["Network"].GetInt("inventory_server_port", 8004);
92 InventoryServerName = config.Configs["Network"].GetString("inventory_server_name", "127.0.0.1");
90 } 93 }
91 } 94 }
92} 95}
diff --git a/OpenSim/Framework/General/Types/UUID.cs b/OpenSim/Framework/General/Types/UUID.cs
index 9e9654d..feae4ae 100644
--- a/OpenSim/Framework/General/Types/UUID.cs
+++ b/OpenSim/Framework/General/Types/UUID.cs
@@ -91,12 +91,12 @@ namespace OpenSim.Framework.Types
91 91
92 public void Combine(UUID other) 92 public void Combine(UUID other)
93 { 93 {
94 llUUID.Combine(other.GetLLUUID()); 94 LLUUID.Combine(llUUID, other.GetLLUUID());
95 } 95 }
96 96
97 public void Combine(LLUUID other) 97 public void Combine(LLUUID other)
98 { 98 {
99 llUUID.Combine(other); 99 LLUUID.Combine(llUUID, other);
100 } 100 }
101 101
102 public override bool Equals(Object other) 102 public override bool Equals(Object other)