aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorlbsa712007-09-27 14:57:43 +0000
committerlbsa712007-09-27 14:57:43 +0000
commit863195612bdef56165f2b4354bab280c371618b9 (patch)
tree63cec15a6c0338a8777640ed13fd7c3ce05eeba7
parentrevert change to libsecondlife.dll.config which breaks Linux (diff)
downloadopensim-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.
-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.cs71
-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
-rw-r--r--OpenSim/Grid/InventoryServer/InventoryManager.cs131
-rw-r--r--OpenSim/Grid/InventoryServer/InventoryService.cs136
-rw-r--r--OpenSim/Grid/InventoryServer/Main.cs113
-rw-r--r--OpenSim/Grid/UserServer/Main.cs11
-rw-r--r--OpenSim/Grid/UserServer/UserLoginService.cs39
-rw-r--r--OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs5
-rw-r--r--OpenSim/Region/ClientStack/ClientView.cs1
-rw-r--r--OpenSim/Region/Communications/Local/CommunicationsLocal.cs2
-rw-r--r--OpenSim/Region/Communications/Local/LocalInventoryService.cs3
-rw-r--r--OpenSim/Region/Communications/Local/LocalLoginService.cs51
-rw-r--r--OpenSim/Region/Communications/Local/LocalUserServices.cs5
-rw-r--r--OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs2
-rw-r--r--OpenSim/Region/Communications/OGS1/OGS1GridServices.cs20
-rw-r--r--OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs69
-rw-r--r--OpenSim/Region/Environment/Modules/ChatModule.cs4
-rw-r--r--OpenSim/Region/Environment/Scenes/ScenePresence.cs6
-rw-r--r--bin/Inventory_Default.xml62
-rw-r--r--bin/Inventory_Library.xml63
-rw-r--r--bin/libsecondlife.dllbin1515520 -> 1415168 bytes
-rw-r--r--prebuild.xml36
-rw-r--r--share/sql/mysql-inventoryfolders.sql2
37 files changed, 425 insertions, 1155 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;
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;
11using OpenSim.Framework.Utilities; 12using OpenSim.Framework.Utilities;
12using OpenSim.Framework.Servers; 13using 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
39namespace OpenSim.Framework.Communications.Caches 39namespace 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;
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;
41 38
42namespace OpenSim.Framework.Communications.Caches 39namespace 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;
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;
39 38
40namespace OpenSim.Framework.Communications.Caches 39namespace 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 @@
1using System; 1using System;
2using System.Text;
3using System.Collections.Generic; 2using System.Collections.Generic;
4 3using System.Text;
5using libsecondlife;
6using OpenSim.Framework.Data; 4using OpenSim.Framework.Data;
5using libsecondlife;
7using OpenSim.Framework.Communications.Caches; 6using 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, 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 @@
1using System; 1using System;
2using System.Text;
3using System.IO;
4using System.Xml;
5using System.Xml.Serialization;
6using System.Collections;
7using System.Collections.Generic; 2using System.Collections.Generic;
8using System.Reflection; 3using System.Reflection;
9using libsecondlife; 4using libsecondlife;
@@ -11,20 +6,21 @@ using OpenSim.Framework.Communications;
11using OpenSim.Framework.Console; 6using OpenSim.Framework.Console;
12using OpenSim.Framework.Data; 7using OpenSim.Framework.Data;
13using InventoryFolder=OpenSim.Framework.Communications.Caches.InventoryFolder; 8using InventoryFolder=OpenSim.Framework.Communications.Caches.InventoryFolder;
14using InventoryCategory = OpenSim.Framework.Data.InventoryCategory;
15 9
16namespace OpenSim.Framework.Communications 10namespace 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;
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;
11using OpenSim.Framework.Utilities; 12using OpenSim.Framework.Utilities;
12using OpenSim.Framework.Communications;
13using OpenSim.Framework.Configuration;
14 13
14using OpenSim.Framework.Configuration;
15using InventoryFolder = OpenSim.Framework.Inventory.InventoryFolder;
15 16
16namespace OpenSim.Framework.UserManagement 17namespace 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}
diff --git a/OpenSim/Framework/Data.MySQL/MySQLInventoryData.cs b/OpenSim/Framework/Data.MySQL/MySQLInventoryData.cs
index 8a7e869..5009d9e 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 OR category = 0)", param); 135 IDbCommand result = database.Query("SELECT * FROM inventoryfolders WHERE parentFolderID = ?zero AND agentID = ?uuid", 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,6 +152,40 @@ 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>
155 /// Returns a list of folders in a users inventory contained within the specified folder 189 /// Returns a list of folders in a users inventory contained within the specified folder
156 /// </summary> 190 /// </summary>
157 /// <param name="parentID">The folder to search</param> 191 /// <param name="parentID">The folder to search</param>
@@ -314,27 +348,5 @@ namespace OpenSim.Framework.Data.MySQL
314 { 348 {
315 addInventoryFolder(folder); 349 addInventoryFolder(folder);
316 } 350 }
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
339 } 351 }
340} 352}
diff --git a/OpenSim/Framework/Data.MySQL/MySQLManager.cs b/OpenSim/Framework/Data.MySQL/MySQLManager.cs
index e55606e..5037f98 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 MySqlConnection dbcon; 44 IDbConnection dbcon;
45 /// <summary> 45 /// <summary>
46 /// Connection string for ADO.net 46 /// Connection string for ADO.net
47 /// </summary> 47 /// </summary>
@@ -115,11 +115,10 @@ 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 if(parameters != null) 118 foreach (KeyValuePair<string, string> param in parameters)
119 foreach (KeyValuePair<string, string> param in parameters) 119 {
120 { 120 dbcommand.Parameters.Add(param.Key, param.Value);
121 dbcommand.Parameters.Add(param.Key, param.Value); 121 }
122 }
123 122
124 return (IDbCommand)dbcommand; 123 return (IDbCommand)dbcommand;
125 } 124 }
@@ -150,11 +149,10 @@ namespace OpenSim.Framework.Data.MySQL
150 { 149 {
151 MySqlCommand dbcommand = (MySqlCommand)dbcon.CreateCommand(); 150 MySqlCommand dbcommand = (MySqlCommand)dbcon.CreateCommand();
152 dbcommand.CommandText = sql; 151 dbcommand.CommandText = sql;
153 if(parameters != null) 152 foreach (KeyValuePair<string, string> param in parameters)
154 foreach (KeyValuePair<string, string> param in parameters) 153 {
155 { 154 dbcommand.Parameters.Add(param.Key, param.Value);
156 dbcommand.Parameters.Add(param.Key, param.Value); 155 }
157 }
158 156
159 return (IDbCommand)dbcommand; 157 return (IDbCommand)dbcommand;
160 } 158 }
@@ -372,8 +370,6 @@ namespace OpenSim.Framework.Data.MySQL
372 folder.parentID = new LLUUID((string)reader["parentFolderID"]); 370 folder.parentID = new LLUUID((string)reader["parentFolderID"]);
373 folder.folderID = new LLUUID((string)reader["folderID"]); 371 folder.folderID = new LLUUID((string)reader["folderID"]);
374 folder.name = (string)reader["folderName"]; 372 folder.name = (string)reader["folderName"];
375 folder.category = (InventoryCategory)((Int16)reader["category"]);
376 folder.type = (Int16)reader["folderType"];
377 373
378 rows.Add(folder); 374 rows.Add(folder);
379 } 375 }
@@ -513,32 +509,24 @@ namespace OpenSim.Framework.Data.MySQL
513 /// <returns>Success?</returns> 509 /// <returns>Success?</returns>
514 public bool insertFolder(InventoryFolderBase folder) 510 public bool insertFolder(InventoryFolderBase folder)
515 { 511 {
516 string sql = "REPLACE INTO inventoryfolders (folderID, agentID, parentFolderID, folderName, category, folderType) VALUES "; 512 string sql = "REPLACE INTO inventoryfolders (folderID, agentID, parentFolderID, folderName) VALUES ";
517 sql += "(?folderID, ?agentID, ?parentFolderID, ?folderName, ?category, ?folderType)"; 513 sql += "(?folderID, ?agentID, ?parentFolderID, ?folderName)";
518 514
519 MySqlCommand dbcmd = dbcon.CreateCommand(); 515 Dictionary<string, string> parameters = new Dictionary<string, string>();
520 dbcmd.CommandText = sql; 516 parameters["?folderID"] = folder.folderID.ToStringHyphenated();
521 517 parameters["?agentID"] = folder.agentID.ToStringHyphenated();
522 LLUUID tmpID = folder.folderID; 518 parameters["?parentFolderID"] = folder.parentID.ToStringHyphenated();
523 dbcmd.Parameters.Add(new MySqlParameter("?folderID", tmpID.ToStringHyphenated())); 519 parameters["?folderName"] = folder.name;
524 dbcmd.Parameters.Add(new MySqlParameter("?folderID", tmpID.ToStringHyphenated())); 520
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
537 bool returnval = false; 521 bool returnval = false;
538 try 522 try
539 { 523 {
540 if (dbcmd.ExecuteNonQuery() == 1) 524 IDbCommand result = Query(sql, parameters);
525
526 if (result.ExecuteNonQuery() == 1)
541 returnval = true; 527 returnval = true;
528
529 result.Dispose();
542 } 530 }
543 catch (Exception e) 531 catch (Exception e)
544 { 532 {
diff --git a/OpenSim/Framework/Data.SQLite/SQLiteInventoryStore.cs b/OpenSim/Framework/Data.SQLite/SQLiteInventoryStore.cs
index eb0ba04..d3d752f 100644
--- a/OpenSim/Framework/Data.SQLite/SQLiteInventoryStore.cs
+++ b/OpenSim/Framework/Data.SQLite/SQLiteInventoryStore.cs
@@ -61,11 +61,10 @@ 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
65 return; 64 return;
66 } 65 }
67 66
68 public InventoryItemBase buildItem(DataRow row) 67 public InventoryItemBase BuildItem(DataRow row)
69 { 68 {
70 InventoryItemBase item = new InventoryItemBase(); 69 InventoryItemBase item = new InventoryItemBase();
71 item.inventoryID = new LLUUID((string)row["UUID"]); 70 item.inventoryID = new LLUUID((string)row["UUID"]);
@@ -183,7 +182,7 @@ namespace OpenSim.Framework.Data.SQLite
183 DataRow[] rows = inventoryItemTable.Select(selectExp); 182 DataRow[] rows = inventoryItemTable.Select(selectExp);
184 foreach (DataRow row in rows) 183 foreach (DataRow row in rows)
185 { 184 {
186 retval.Add(buildItem(row)); 185 retval.Add(BuildItem(row));
187 } 186 }
188 187
189 return retval; 188 return retval;
@@ -196,16 +195,43 @@ namespace OpenSim.Framework.Data.SQLite
196 /// <returns>A list of folder objects</returns> 195 /// <returns>A list of folder objects</returns>
197 public List<InventoryFolderBase> getUserRootFolders(LLUUID user) 196 public List<InventoryFolderBase> getUserRootFolders(LLUUID user)
198 { 197 {
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 {
199 List<InventoryFolderBase> folders = new List<InventoryFolderBase>(); 208 List<InventoryFolderBase> folders = new List<InventoryFolderBase>();
200 DataTable inventoryFolderTable = ds.Tables["inventoryfolders"]; 209 DataTable inventoryFolderTable = ds.Tables["inventoryfolders"];
201 210 string selectExp = "agentID = '" + user.ToString() + "' AND parentID = '" + LLUUID.Zero.ToString() + "'";
202 string selectExp = "parentID = '" + LLUUID.Zero.ToString() + "' AND (agentID = '" + user.ToString() + "' OR category = 0)";
203 DataRow[] rows = inventoryFolderTable.Select(selectExp); 211 DataRow[] rows = inventoryFolderTable.Select(selectExp);
204 foreach (DataRow row in rows) 212 foreach (DataRow row in rows)
205 { 213 {
206 folders.Add(this.buildFolder(row)); 214 folders.Add(this.buildFolder(row));
207 } 215 }
208 return folders; 216
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;
209 } 235 }
210 236
211 /// <summary> 237 /// <summary>
@@ -234,11 +260,7 @@ namespace OpenSim.Framework.Data.SQLite
234 /// <returns>A class containing item information</returns> 260 /// <returns>A class containing item information</returns>
235 public InventoryItemBase getInventoryItem(LLUUID item) 261 public InventoryItemBase getInventoryItem(LLUUID item)
236 { 262 {
237 DataRow row = ds.Tables["inventoryitems"].Rows.Find(item); 263 return null;
238 if (row != null)
239 return this.buildItem(row);
240 else
241 return null;
242 } 264 }
243 265
244 /// <summary> 266 /// <summary>
@@ -248,14 +270,7 @@ namespace OpenSim.Framework.Data.SQLite
248 /// <returns>A class containing folder information</returns> 270 /// <returns>A class containing folder information</returns>
249 public InventoryFolderBase getInventoryFolder(LLUUID folder) 271 public InventoryFolderBase getInventoryFolder(LLUUID folder)
250 { 272 {
251 DataTable inventoryFolderTable = ds.Tables["inventoryfolders"]; 273 return null;
252 string selectExp = "UUID = '" + folder.ToString() + "'";
253 DataRow[] rows = inventoryFolderTable.Select(selectExp);
254
255 if (rows.Length == 1)
256 return this.buildFolder(rows[0]);
257 else
258 return null;
259 } 274 }
260 275
261 /// <summary> 276 /// <summary>
@@ -293,11 +308,6 @@ namespace OpenSim.Framework.Data.SQLite
293 this.invItemsDa.Update(ds, "inventoryitems"); 308 this.invItemsDa.Update(ds, "inventoryitems");
294 } 309 }
295 310
296 //TODO! Implement SQLite deleteInventoryCategory
297 public void deleteInventoryCategory(InventoryCategory inventoryCategory)
298 {
299 }
300
301 /// <summary> 311 /// <summary>
302 /// Adds a new folder specified by folder 312 /// Adds a new folder specified by folder
303 /// </summary> 313 /// </summary>
@@ -316,11 +326,6 @@ namespace OpenSim.Framework.Data.SQLite
316 this.addFolder(folder); 326 this.addFolder(folder);
317 } 327 }
318 328
319 //TODO! implement CreateNewUserInventory
320 public void CreateNewUserInventory(LLUUID user)
321 {
322 throw new Exception("Function not implemented");
323 }
324 329
325 /*********************************************************************** 330 /***********************************************************************
326 * 331 *
@@ -345,7 +350,6 @@ namespace OpenSim.Framework.Data.SQLite
345 createCol(inv, "parentFolderID", typeof(System.String)); 350 createCol(inv, "parentFolderID", typeof(System.String));
346 createCol(inv, "avatarID", typeof(System.String)); 351 createCol(inv, "avatarID", typeof(System.String));
347 createCol(inv, "creatorsID", typeof(System.String)); 352 createCol(inv, "creatorsID", typeof(System.String));
348 createCol(inv, "category", typeof(System.Byte));
349 353
350 createCol(inv, "inventoryName", typeof(System.String)); 354 createCol(inv, "inventoryName", typeof(System.String));
351 createCol(inv, "inventoryDescription", typeof(System.String)); 355 createCol(inv, "inventoryDescription", typeof(System.String));
@@ -369,7 +373,6 @@ namespace OpenSim.Framework.Data.SQLite
369 createCol(fol, "parentID", typeof(System.String)); 373 createCol(fol, "parentID", typeof(System.String));
370 createCol(fol, "type", typeof(System.Int32)); 374 createCol(fol, "type", typeof(System.Int32));
371 createCol(fol, "version", typeof(System.Int32)); 375 createCol(fol, "version", typeof(System.Int32));
372 createCol(fol, "category", typeof(System.Byte));
373 376
374 fol.PrimaryKey = new DataColumn[] { fol.Columns["UUID"] }; 377 fol.PrimaryKey = new DataColumn[] { fol.Columns["UUID"] };
375 return fol; 378 return fol;
@@ -412,7 +415,6 @@ namespace OpenSim.Framework.Data.SQLite
412 folder.parentID = new LLUUID((string)row["parentID"]); 415 folder.parentID = new LLUUID((string)row["parentID"]);
413 folder.type = Convert.ToInt16(row["type"]); 416 folder.type = Convert.ToInt16(row["type"]);
414 folder.version = Convert.ToUInt16(row["version"]); 417 folder.version = Convert.ToUInt16(row["version"]);
415 folder.category = (InventoryCategory)Convert.ToByte(row["category"]);
416 return folder; 418 return folder;
417 } 419 }
418 420
@@ -424,7 +426,6 @@ namespace OpenSim.Framework.Data.SQLite
424 row["parentID"] = folder.parentID; 426 row["parentID"] = folder.parentID;
425 row["type"] = folder.type; 427 row["type"] = folder.type;
426 row["version"] = folder.version; 428 row["version"] = folder.version;
427 row["category"] = folder.category;
428 } 429 }
429 430
430 431
@@ -643,7 +644,3 @@ namespace OpenSim.Framework.Data.SQLite
643 } 644 }
644} 645}
645 646
646
647
648
649
diff --git a/OpenSim/Framework/Data/InventoryData.cs b/OpenSim/Framework/Data/InventoryData.cs
index dc857d8..2df26e1 100644
--- a/OpenSim/Framework/Data/InventoryData.cs
+++ b/OpenSim/Framework/Data/InventoryData.cs
@@ -25,19 +25,15 @@
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;
30using System.Collections.Generic; 28using System.Collections.Generic;
31using libsecondlife; 29using libsecondlife;
32 30
33namespace OpenSim.Framework.Data 31namespace OpenSim.Framework.Data
34{ 32{
35
36 public enum InventoryCategory : byte { Library, Default, User };
37 /// <summary> 33 /// <summary>
38 /// Inventory Item - contains all the properties associated with an individual inventory piece. 34 /// Inventory Item - contains all the properties associated with an individual inventory piece.
39 /// </summary> 35 /// </summary>
40 public class InventoryItemBase : MarshalByRefObject 36 public class InventoryItemBase
41 { 37 {
42 /// <summary> 38 /// <summary>
43 /// A UUID containing the ID for the inventory item itself 39 /// A UUID containing the ID for the inventory item itself
@@ -70,12 +66,10 @@ namespace OpenSim.Framework.Data
70 /// <summary> 66 /// <summary>
71 /// The name of the inventory item (must be less than 64 characters) 67 /// The name of the inventory item (must be less than 64 characters)
72 /// </summary> 68 /// </summary>
73 [XmlElement(ElementName="name")]
74 public string inventoryName; 69 public string inventoryName;
75 /// <summary> 70 /// <summary>
76 /// The description of the inventory item (must be less than 64 characters) 71 /// The description of the inventory item (must be less than 64 characters)
77 /// </summary> 72 /// </summary>
78 [XmlElement(ElementName = "description")]
79 public string inventoryDescription; 73 public string inventoryDescription;
80 /// <summary> 74 /// <summary>
81 /// A mask containing the permissions for the next owner (cannot be enforced) 75 /// A mask containing the permissions for the next owner (cannot be enforced)
@@ -98,7 +92,7 @@ namespace OpenSim.Framework.Data
98 /// <summary> 92 /// <summary>
99 /// A Class for folders which contain users inventory 93 /// A Class for folders which contain users inventory
100 /// </summary> 94 /// </summary>
101 public class InventoryFolderBase : MarshalByRefObject 95 public class InventoryFolderBase
102 { 96 {
103 /// <summary> 97 /// <summary>
104 /// The name of the folder (64 characters or less) 98 /// The name of the folder (64 characters or less)
@@ -124,10 +118,6 @@ namespace OpenSim.Framework.Data
124 /// 118 ///
125 /// </summary> 119 /// </summary>
126 public ushort version; 120 public ushort version;
127 /// <summary>
128 /// Inventory category, Library, Default, System
129 /// </summary>
130 public InventoryCategory category;
131 } 121 }
132 122
133 /// <summary> 123 /// <summary>
@@ -172,6 +162,13 @@ namespace OpenSim.Framework.Data
172 List<InventoryFolderBase> getUserRootFolders(LLUUID user); 162 List<InventoryFolderBase> getUserRootFolders(LLUUID user);
173 163
174 /// <summary> 164 /// <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>
175 /// Returns a list of inventory folders contained in the folder 'parentID' 172 /// Returns a list of inventory folders contained in the folder 'parentID'
176 /// </summary> 173 /// </summary>
177 /// <param name="parentID">The folder to get subfolders for</param> 174 /// <param name="parentID">The folder to get subfolders for</param>
@@ -221,17 +218,5 @@ namespace OpenSim.Framework.Data
221 /// </summary> 218 /// </summary>
222 /// <param name="folder">The inventory folder</param> 219 /// <param name="folder">The inventory folder</param>
223 void updateInventoryFolder(InventoryFolderBase folder); 220 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);
236 } 221 }
237} 222}
diff --git a/OpenSim/Framework/General/Configuration/InventoryConfig.cs b/OpenSim/Framework/General/Configuration/InventoryConfig.cs
deleted file mode 100644
index d84609b..0000000
--- a/OpenSim/Framework/General/Configuration/InventoryConfig.cs
+++ /dev/null
@@ -1,67 +0,0 @@
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 16a7de4..776b911 100644
--- a/OpenSim/Framework/General/Configuration/UserConfig.cs
+++ b/OpenSim/Framework/General/Configuration/UserConfig.cs
@@ -18,9 +18,6 @@ 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
24 private ConfigurationMember configMember; 21 private ConfigurationMember configMember;
25 22
26 public UserConfig(string description, string filename) 23 public UserConfig(string description, string filename)
@@ -40,8 +37,6 @@ namespace OpenSim.Framework.Configuration
40 37
41 configMember.addConfigurationOption("http_port", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, "Http Listener port", "8002", false); 38 configMember.addConfigurationOption("http_port", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, "Http Listener port", "8002", false);
42 39
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);
45 } 40 }
46 41
47 public bool handleIncomingConfiguration(string configuration_key, object configuration_result) 42 public bool handleIncomingConfiguration(string configuration_key, object configuration_result)
@@ -64,12 +59,6 @@ namespace OpenSim.Framework.Configuration
64 this.DatabaseProvider = (string)configuration_result; 59 this.DatabaseProvider = (string)configuration_result;
65 break; 60 break;
66 61
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;
73 case "http_port": 62 case "http_port":
74 HttpPort = (uint)configuration_result; 63 HttpPort = (uint)configuration_result;
75 break; 64 break;
diff --git a/OpenSim/Framework/General/Types/NetworkServersInfo.cs b/OpenSim/Framework/General/Types/NetworkServersInfo.cs
index cf194fc..b65488a 100644
--- a/OpenSim/Framework/General/Types/NetworkServersInfo.cs
+++ b/OpenSim/Framework/General/Types/NetworkServersInfo.cs
@@ -49,8 +49,6 @@ 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 = "";
54 52
55 public NetworkServersInfo() 53 public NetworkServersInfo()
56 { 54 {
@@ -88,8 +86,7 @@ namespace OpenSim.Framework.Types
88 UserSendKey = config.Configs["Network"].GetString("user_send_key", "null"); 86 UserSendKey = config.Configs["Network"].GetString("user_send_key", "null");
89 UserRecvKey = config.Configs["Network"].GetString("user_recv_key", "null"); 87 UserRecvKey = config.Configs["Network"].GetString("user_recv_key", "null");
90 AssetURL = config.Configs["Network"].GetString("asset_server_url", "http://127.0.0.1:8003"); 88 AssetURL = config.Configs["Network"].GetString("asset_server_url", "http://127.0.0.1:8003");
91 InventoryServerPort = config.Configs["Network"].GetInt("inventory_server_port", 8004); 89
92 InventoryServerName = config.Configs["Network"].GetString("inventory_server_name", "127.0.0.1");
93 } 90 }
94 } 91 }
95} 92}
diff --git a/OpenSim/Framework/General/Types/UUID.cs b/OpenSim/Framework/General/Types/UUID.cs
index feae4ae..9e9654d 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(llUUID, other.GetLLUUID()); 94 llUUID.Combine(other.GetLLUUID());
95 } 95 }
96 96
97 public void Combine(LLUUID other) 97 public void Combine(LLUUID other)
98 { 98 {
99 LLUUID.Combine(llUUID, other); 99 llUUID.Combine(other);
100 } 100 }
101 101
102 public override bool Equals(Object other) 102 public override bool Equals(Object other)
diff --git a/OpenSim/Grid/InventoryServer/InventoryManager.cs b/OpenSim/Grid/InventoryServer/InventoryManager.cs
index a46f359..016b8bb 100644
--- a/OpenSim/Grid/InventoryServer/InventoryManager.cs
+++ b/OpenSim/Grid/InventoryServer/InventoryManager.cs
@@ -26,34 +26,37 @@
26* 26*
27*/ 27*/
28using System; 28using System;
29using System.Text;
30using System.Reflection;
31using System.Collections; 29using System.Collections;
32using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Text;
32using OpenGrid.Framework.Data;
33using libsecondlife; 33using libsecondlife;
34using System.Reflection;
34 35
35using System.Xml; 36using System.Xml;
36using OpenSim.Framework.Console; 37using Nwc.XmlRpc;
38using OpenSim.Framework.Sims;
39using OpenSim.Framework.Inventory;
37using OpenSim.Framework.Utilities; 40using OpenSim.Framework.Utilities;
38using OpenSim.Framework.Data;
39using InventoryCategory = OpenSim.Framework.Data.InventoryCategory;
40 41
41namespace OpenSim.Grid.InventoryServer 42using System.Security.Cryptography;
43
44namespace OpenGridServices.InventoryServer
42{ 45{
43 class InventoryManager : IInventoryData 46 class InventoryManager
44 { 47 {
45 IInventoryData _databasePlugin; 48 Dictionary<string, IInventoryData> _plugins = new Dictionary<string, IInventoryData>();
46 49
47 /// <summary> 50 /// <summary>
48 /// Adds a new inventory server plugin - user servers will be requested in the order they were loaded. 51 /// Adds a new inventory server plugin - user servers will be requested in the order they were loaded.
49 /// </summary> 52 /// </summary>
50 /// <param name="FileName">The filename to the inventory server plugin DLL</param> 53 /// <param name="FileName">The filename to the inventory server plugin DLL</param>
51 public void AddDatabasePlugin(string FileName) 54 public void AddPlugin(string FileName)
52 { 55 {
53 MainLog.Instance.Verbose(OpenInventory_Main.MainLogName, "Invenstorage: Attempting to load " + FileName); 56 OpenSim.Framework.Console.MainConsole.Instance.Verbose( "Invenstorage: Attempting to load " + FileName);
54 Assembly pluginAssembly = Assembly.LoadFrom(FileName); 57 Assembly pluginAssembly = Assembly.LoadFrom(FileName);
55 58
56 MainLog.Instance.Verbose(OpenInventory_Main.MainLogName, "Invenstorage: Found " + pluginAssembly.GetTypes().Length + " interfaces."); 59 OpenSim.Framework.Console.MainConsole.Instance.Verbose( "Invenstorage: Found " + pluginAssembly.GetTypes().Length + " interfaces.");
57 foreach (Type pluginType in pluginAssembly.GetTypes()) 60 foreach (Type pluginType in pluginAssembly.GetTypes())
58 { 61 {
59 if (!pluginType.IsAbstract) 62 if (!pluginType.IsAbstract)
@@ -64,9 +67,8 @@ namespace OpenSim.Grid.InventoryServer
64 { 67 {
65 IInventoryData plug = (IInventoryData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); 68 IInventoryData plug = (IInventoryData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
66 plug.Initialise(); 69 plug.Initialise();
67 _databasePlugin = plug; 70 this._plugins.Add(plug.getName(), plug);
68 MainLog.Instance.Verbose(OpenInventory_Main.MainLogName, "Invenstorage: Added IInventoryData Interface"); 71 OpenSim.Framework.Console.MainConsole.Instance.Verbose( "Invenstorage: Added IUserData Interface");
69 break;
70 } 72 }
71 73
72 typeInterface = null; 74 typeInterface = null;
@@ -78,87 +80,46 @@ namespace OpenSim.Grid.InventoryServer
78 80
79 public List<InventoryFolderBase> getRootFolders(LLUUID user) 81 public List<InventoryFolderBase> getRootFolders(LLUUID user)
80 { 82 {
83 foreach (KeyValuePair<string, IInventoryData> kvp in _plugins)
84 {
85 try
86 {
87 return kvp.Value.getUserRootFolders(user);
88 }
89 catch (Exception e)
90 {
91 OpenSim.Framework.Console.MainConsole.Instance.Notice("Unable to get root folders via " + kvp.Key + " (" + e.ToString() + ")");
92 }
93 }
81 return null; 94 return null;
82 } 95 }
83 96
84 #region IInventoryData Members 97 public XmlRpcResponse XmlRpcInventoryRequest(XmlRpcRequest request)
85
86
87 public List<InventoryItemBase> getInventoryInFolder(LLUUID folderID)
88 {
89 return _databasePlugin.getInventoryInFolder(folderID);
90 }
91
92 public List<InventoryFolderBase> getUserRootFolders(LLUUID user)
93 {
94 return _databasePlugin.getUserRootFolders(user);
95 }
96
97 public List<InventoryFolderBase> getInventoryFolders(LLUUID parentID)
98 {
99 return _databasePlugin.getInventoryFolders(parentID);
100 }
101
102 public InventoryItemBase getInventoryItem(LLUUID item)
103 {
104 throw new Exception("The method or operation is not implemented.");
105 }
106
107 public InventoryFolderBase getInventoryFolder(LLUUID folder)
108 {
109 return _databasePlugin.getInventoryFolder(folder);
110 }
111
112 public void addInventoryItem(InventoryItemBase item)
113 { 98 {
114 _databasePlugin.addInventoryItem(item); 99 XmlRpcResponse response = new XmlRpcResponse();
115 } 100 Hashtable requestData = (Hashtable)request.Params[0];
116
117 public void updateInventoryItem(InventoryItemBase item)
118 {
119 throw new Exception("The method or operation is not implemented.");
120 }
121
122 public void deleteInventoryItem(InventoryItemBase item)
123 {
124 throw new Exception("The method or operation is not implemented.");
125 }
126 101
127 public void addInventoryFolder(InventoryFolderBase folder) 102 Hashtable responseData = new Hashtable();
128 {
129 _databasePlugin.addInventoryFolder(folder);
130 }
131 103
132 public void updateInventoryFolder(InventoryFolderBase folder) 104 // Stuff happens here
133 {
134 throw new Exception("The method or operation is not implemented.");
135 }
136
137 public void Initialise()
138 {
139 throw new Exception("The method or operation is not implemented.");
140 }
141 105
142 public void Close() 106 if (requestData.ContainsKey("Access-type"))
143 { 107 {
144 throw new Exception("The method or operation is not implemented."); 108 if (requestData["access-type"] == "rootfolders")
145 } 109 {
110// responseData["rootfolders"] =
111 }
112 }
113 else
114 {
115 responseData["error"] = "No access-type specified.";
116 }
146 117
147 public string getName()
148 {
149 throw new Exception("The method or operation is not implemented.");
150 }
151 118
152 public string getVersion() 119 // Stuff stops happening here
153 {
154 throw new Exception("The method or operation is not implemented.");
155 }
156 120
157 public void deleteInventoryCategory(InventoryCategory inventoryCategory) 121 response.Value = responseData;
158 { 122 return response;
159 _databasePlugin.deleteInventoryCategory(inventoryCategory);
160 } 123 }
161
162 #endregion
163 } 124 }
164} 125}
diff --git a/OpenSim/Grid/InventoryServer/InventoryService.cs b/OpenSim/Grid/InventoryServer/InventoryService.cs
deleted file mode 100644
index cbc0558..0000000
--- a/OpenSim/Grid/InventoryServer/InventoryService.cs
+++ /dev/null
@@ -1,136 +0,0 @@
1using System;
2using System.Runtime.Remoting;
3using System.Runtime.Remoting.Channels;
4using System.Runtime.Remoting.Channels.Tcp;
5using System.Runtime.Serialization.Formatters;
6using System.Collections;
7using System.Collections.Generic;
8
9
10using libsecondlife;
11using OpenSim.Framework.Data;
12using OpenSim.Framework.Communications;
13using OpenSim.Framework.Configuration;
14using InventoryCategory = OpenSim.Framework.Data.InventoryCategory;
15
16namespace OpenSim.Grid.InventoryServer
17{
18 class InventoryServiceSingleton : OpenSim.Framework.Communications.InventoryServiceBase
19 {
20 static InventoryManager _inventoryManager;
21
22 static public InventoryManager InventoryManager
23 {
24 set { _inventoryManager = value; }
25 get { return _inventoryManager; }
26 }
27
28#region Singleton Pattern
29 static InventoryServiceSingleton instance=null;
30
31 InventoryServiceSingleton()
32 {
33 }
34
35 public static InventoryServiceSingleton Instance
36 {
37 get
38 {
39 if (instance==null)
40 {
41 instance = new InventoryServiceSingleton();
42 }
43 return instance;
44 }
45 }
46#endregion
47
48#region IInventoryServices Members
49
50 public override void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack, InventoryItemInfo itemCallBack)
51 {
52 List<InventoryFolderBase> folders = this.RequestFirstLevelFolders(userID);
53 InventoryFolderBase rootFolder = null;
54
55 //need to make sure we send root folder first
56 foreach (InventoryFolderBase folder in folders)
57 {
58 if (folder.parentID == libsecondlife.LLUUID.Zero)
59 {
60 rootFolder = folder;
61 folderCallBack(userID, folder);
62 }
63 }
64
65 if (rootFolder != null)
66 {
67 foreach (InventoryFolderBase folder in folders)
68 {
69 if (folder.folderID != rootFolder.folderID)
70 {
71 folderCallBack(userID, folder);
72
73 List<InventoryItemBase> items = this.RequestFolderItems(folder.folderID);
74 foreach (InventoryItemBase item in items)
75 {
76 itemCallBack(userID, item);
77 }
78 }
79 }
80 }
81
82 }
83
84 public override void AddNewInventoryFolder(LLUUID userID, InventoryFolderBase folder)
85 {
86 _inventoryManager.addInventoryFolder(folder);
87 }
88
89 public override void AddNewInventoryItem(LLUUID userID, InventoryItemBase item)
90 {
91 throw new Exception("Not implemented exception");
92 }
93
94 public override void DeleteInventoryItem(LLUUID userID, InventoryItemBase item)
95 {
96 throw new Exception("Not implemented exception");
97 }
98
99 public List<InventoryItemBase> RequestFolderItems(LLUUID folderID)
100 {
101 return _inventoryManager.getInventoryInFolder(folderID);
102 }
103
104
105#endregion
106 }
107
108 class InventoryService
109 {
110 InventoryServiceSingleton _inventoryServiceMethods;
111 public InventoryService(InventoryManager inventoryManager, InventoryConfig cfg)
112 {
113 // we only need to register the tcp channel once, and we don't know which other modules use remoting
114 if (ChannelServices.GetChannel("tcp") == null)
115 {
116 // Creating a custom formatter for a TcpChannel sink chain.
117 BinaryServerFormatterSinkProvider serverProvider = new BinaryServerFormatterSinkProvider();
118 serverProvider.TypeFilterLevel = TypeFilterLevel.Full;
119
120 IDictionary props = new Hashtable();
121 props["port"] = cfg.RemotingPort;
122 props["typeFilterLevel"] = TypeFilterLevel.Full;
123
124 // Pass the properties for the port setting and the server provider in the server chain argument. (Client remains null here.)
125 ChannelServices.RegisterChannel(new TcpChannel(props, null, serverProvider), true);
126 }
127
128 // Register the object
129 RemotingConfiguration.RegisterWellKnownServiceType(typeof(InventoryServiceSingleton), "Inventory", WellKnownObjectMode.Singleton);
130
131 _inventoryServiceMethods = InventoryServiceSingleton.Instance;
132 InventoryServiceSingleton.InventoryManager = inventoryManager;
133 }
134
135 }
136}
diff --git a/OpenSim/Grid/InventoryServer/Main.cs b/OpenSim/Grid/InventoryServer/Main.cs
index 392c741..97addb0 100644
--- a/OpenSim/Grid/InventoryServer/Main.cs
+++ b/OpenSim/Grid/InventoryServer/Main.cs
@@ -31,130 +31,49 @@ using System.Collections.Generic;
31using System.Reflection; 31using System.Reflection;
32using System.IO; 32using System.IO;
33using System.Text; 33using System.Text;
34using System.Xml;
35
36using libsecondlife; 34using libsecondlife;
35using OpenSim.Framework.User;
36using OpenSim.Framework.Sims;
37using OpenSim.Framework.Inventory;
37using OpenSim.Framework.Interfaces; 38using OpenSim.Framework.Interfaces;
38using OpenSim.Framework.Console; 39using OpenSim.Framework.Console;
40using OpenSim.Servers;
39using OpenSim.Framework.Utilities; 41using OpenSim.Framework.Utilities;
40using OpenSim.Framework.Configuration;
41using OpenSim.Framework.Data;
42using InventoryCategory = OpenSim.Framework.Data.InventoryCategory;
43 42
44namespace OpenSim.Grid.InventoryServer 43namespace OpenGridServices.InventoryServer
45{ 44{
46 45 public class OpenInventory_Main : BaseServer, conscmd_callback
47 public class OpenInventory_Main : conscmd_callback
48 { 46 {
47 ConsoleBase m_console;
48 InventoryManager m_inventoryManager;
49 49
50 public const string MainLogName = "INVENTORY";
51
52 private InventoryConfig m_config;
53 LogBase m_console;
54 InventoryManager m_inventoryManager; ///connection the database backend
55 InventoryService m_inventoryService; ///Remoting interface, where messages arrive
56 [STAThread]
57 public static void Main(string[] args) 50 public static void Main(string[] args)
58 { 51 {
59 Console.WriteLine("Launching InventoryServer...");
60
61 OpenInventory_Main inventoryServer = new OpenInventory_Main();
62
63 inventoryServer.Startup();
64
65// inventoryServer.RunCmd("load", new string[] { "library", "inventory_library.xml" });
66// inventoryServer.RunCmd("load", new string[] { "default", "inventory_default.xml" });
67
68 inventoryServer.Work();
69 } 52 }
70 53
71 public OpenInventory_Main() 54 public OpenInventory_Main()
72 { 55 {
73 56 m_console = new ConsoleBase("opengrid-inventory-console.log", "OpenInventory", this, false);
74 if (!Directory.Exists(Util.logDir())) 57 MainConsole.Instance = m_console;
75 {
76 Directory.CreateDirectory(Util.logDir());
77 }
78
79 m_console = new LogBase(Path.Combine(Util.logDir(), "opensim-inventory-console.log"), "OpenInventory", this, false);
80 MainLog.Instance = m_console;
81 }
82
83 private void Work()
84 {
85 m_console.Notice(OpenInventory_Main.MainLogName, "Enter help for a list of commands\n");
86
87 while (true)
88 {
89 m_console.MainLogPrompt();
90 }
91 } 58 }
92 59
93 public void Startup() 60 public void Startup()
94 { 61 {
95 MainLog.Instance.Verbose(OpenInventory_Main.MainLogName, "Initialising inventory manager..."); 62 MainConsole.Instance.Notice("Initialising inventory manager...");
96
97 m_config = new InventoryConfig(OpenInventory_Main.MainLogName, (Path.Combine(Util.configDir(), "InventoryServer_Config.xml")));
98
99 // instantiate the manager, responsible for doing the actual storage
100 m_inventoryManager = new InventoryManager(); 63 m_inventoryManager = new InventoryManager();
101 m_inventoryManager.AddDatabasePlugin(m_config.DatabaseProvider);
102
103 m_inventoryService = new InventoryService(m_inventoryManager, m_config);
104 64
105 // Dig out the embedded version number of this assembly 65 MainConsole.Instance.Notice("Starting HTTP server");
106 Assembly assembly = Assembly.GetExecutingAssembly(); 66 BaseHttpServer httpServer = new BaseHttpServer(8004);
107 string serverExeName = assembly.ManifestModule.Name;
108 Version serverExeVersion = AssemblyName.GetAssemblyName(serverExeName).Version;
109 67
110 m_console.Status(OpenInventory_Main.MainLogName, "Inventoryserver {0}.{1}.{2}.{3} - Startup complete", serverExeVersion.Major, serverExeVersion.Minor, serverExeVersion.Revision, serverExeVersion.Build); 68 httpServer.AddXmlRPCHandler("rootfolders", m_inventoryManager.XmlRpcInventoryRequest);
111 } 69 //httpServer.AddRestHandler("GET","/rootfolders/",Rest
112
113
114 public void Load(string[] cmdparams)
115 {
116 string cmd = cmdparams[0];
117 string fileName = cmdparams[1];
118
119 if (cmdparams.Length != 2)
120 {
121 cmd = "help";
122 }
123
124 switch (cmd)
125 {
126 case "library":
127 InventoryServiceSingleton.Instance.loadInventoryFromXmlFile(InventoryCategory.Library, fileName);
128 break;
129 case "default":
130 InventoryServiceSingleton.Instance.loadInventoryFromXmlFile(InventoryCategory.Default, fileName);
131 break;
132 case "user":
133 InventoryServiceSingleton.Instance.loadInventoryFromXmlFile(InventoryCategory.User, fileName);
134 break;
135 case "help":
136 m_console.Notice("load library <filename>, load library inventory, shared between all users");
137 m_console.Notice("load default <filename>, load template inventory, used when creating a new user inventory");
138 m_console.Notice("load user <first> <last>, load inventory for a specific users, warning this will reset the contents of the inventory");
139 break;
140 }
141 } 70 }
142 71
143 public void RunCmd(string cmd, string[] cmdparams) 72 public void RunCmd(string cmd, string[] cmdparams)
144 { 73 {
145 switch (cmd) 74 switch (cmd)
146 { 75 {
147 case "help":
148 m_console.Notice("load - load verious inventories, use \"load help\", to see a list of commands");
149 m_console.Notice("shutdown - shutdown the grid (USE CAUTION!)");
150 m_console.Notice("quit - shutdown the grid (USE CAUTION!)");
151 break;
152 case "load":
153 Load(cmdparams);
154 break;
155 case "quit":
156 case "shutdown": 76 case "shutdown":
157 MainLog.Instance.Verbose(OpenInventory_Main.MainLogName, "Shutting down inventory server");
158 m_console.Close(); 77 m_console.Close();
159 Environment.Exit(0); 78 Environment.Exit(0);
160 break; 79 break;
diff --git a/OpenSim/Grid/UserServer/Main.cs b/OpenSim/Grid/UserServer/Main.cs
index 28635dd..c2822b6 100644
--- a/OpenSim/Grid/UserServer/Main.cs
+++ b/OpenSim/Grid/UserServer/Main.cs
@@ -36,8 +36,6 @@ using OpenSim.Framework.Interfaces;
36using OpenSim.Framework.Servers; 36using OpenSim.Framework.Servers;
37using OpenSim.Framework.Utilities; 37using OpenSim.Framework.Utilities;
38using OpenSim.Framework.Configuration; 38using OpenSim.Framework.Configuration;
39using OpenSim.Framework.Communications;
40using OpenSim.Region.Communications.OGS1;
41 39
42namespace OpenSim.Grid.UserServer 40namespace OpenSim.Grid.UserServer
43{ 41{
@@ -50,8 +48,6 @@ namespace OpenSim.Grid.UserServer
50 public UserManager m_userManager; 48 public UserManager m_userManager;
51 public UserLoginService m_loginService; 49 public UserLoginService m_loginService;
52 50
53 public IInventoryServices m_inventoryService;
54
55 LogBase m_console; 51 LogBase m_console;
56 52
57 [STAThread] 53 [STAThread]
@@ -94,11 +90,7 @@ namespace OpenSim.Grid.UserServer
94 m_userManager._config = Cfg; 90 m_userManager._config = Cfg;
95 m_userManager.AddPlugin(Cfg.DatabaseProvider); 91 m_userManager.AddPlugin(Cfg.DatabaseProvider);
96 92
97 // prepare connection to the inventory server 93 m_loginService = new UserLoginService(m_userManager, Cfg, Cfg.DefaultStartupMsg);
98 m_inventoryService = new OGS1InventoryService(Cfg.InventoryServerName, Cfg.InventoryServerPort, null);
99
100
101 m_loginService = new UserLoginService(m_userManager, m_inventoryService, Cfg, Cfg.DefaultStartupMsg);
102 94
103 MainLog.Instance.Verbose("Main.cs:Startup() - Starting HTTP process"); 95 MainLog.Instance.Verbose("Main.cs:Startup() - Starting HTTP process");
104 BaseHttpServer httpServer = new BaseHttpServer((int)Cfg.HttpPort); 96 BaseHttpServer httpServer = new BaseHttpServer((int)Cfg.HttpPort);
@@ -111,7 +103,6 @@ namespace OpenSim.Grid.UserServer
111 httpServer.AddStreamHandler( new RestStreamHandler("DELETE", "/usersessions/", m_userManager.RestDeleteUserSessionMethod )); 103 httpServer.AddStreamHandler( new RestStreamHandler("DELETE", "/usersessions/", m_userManager.RestDeleteUserSessionMethod ));
112 104
113 httpServer.Start(); 105 httpServer.Start();
114
115 m_console.Status("SERVER", "Userserver 0.3 - Startup complete"); 106 m_console.Status("SERVER", "Userserver 0.3 - Startup complete");
116 } 107 }
117 108
diff --git a/OpenSim/Grid/UserServer/UserLoginService.cs b/OpenSim/Grid/UserServer/UserLoginService.cs
index f0140a5..95192e3 100644
--- a/OpenSim/Grid/UserServer/UserLoginService.cs
+++ b/OpenSim/Grid/UserServer/UserLoginService.cs
@@ -6,7 +6,6 @@ using OpenSim.Framework.Data;
6using OpenSim.Framework.UserManagement; 6using OpenSim.Framework.UserManagement;
7using OpenSim.Framework.Utilities; 7using OpenSim.Framework.Utilities;
8using OpenSim.Framework.Configuration; 8using OpenSim.Framework.Configuration;
9using OpenSim.Framework.Communications;
10 9
11namespace OpenSim.Grid.UserServer 10namespace OpenSim.Grid.UserServer
12{ 11{
@@ -14,8 +13,8 @@ namespace OpenSim.Grid.UserServer
14 { 13 {
15 public UserConfig m_config; 14 public UserConfig m_config;
16 15
17 public UserLoginService(UserManagerBase userManager, IInventoryServices inventoryServer, UserConfig config, string welcomeMess) 16 public UserLoginService(UserManagerBase userManager, UserConfig config, string welcomeMess)
18 : base(userManager, inventoryServer, welcomeMess) 17 : base(userManager, welcomeMess)
19 { 18 {
20 m_config = config; 19 m_config = config;
21 } 20 }
@@ -72,29 +71,25 @@ namespace OpenSim.Grid.UserServer
72 theUser.currentAgent.currentHandle = SimInfo.regionHandle; 71 theUser.currentAgent.currentHandle = SimInfo.regionHandle;
73 72
74 System.Console.WriteLine("Informing region --> " + SimInfo.httpServerURI); 73 System.Console.WriteLine("Informing region --> " + SimInfo.httpServerURI);
75 // Send 74 // Send
76 try 75 try
77 { 76 {
78 XmlRpcRequest GridReq = new XmlRpcRequest("expect_user", SendParams); 77 XmlRpcRequest GridReq = new XmlRpcRequest("expect_user", SendParams);
79 XmlRpcResponse GridResp = GridReq.Send(SimInfo.httpServerURI, 6000); 78 XmlRpcResponse GridResp = GridReq.Send(SimInfo.httpServerURI, 6000);
80 } 79 }
81 catch( WebException e ) 80 catch( WebException e )
82 { 81 {
83 switch( e.Status ) 82 switch( e.Status )
84 { 83 {
85 case WebExceptionStatus.Timeout: 84 case WebExceptionStatus.Timeout:
86 //TODO: Send him to nearby or default region instead 85 //TODO: Send him to nearby or default region instead
87 break; 86 break;
88 87
89 default: 88 default:
90 throw; 89 throw;
91 } 90 }
92 } 91 }
93 } 92 }
94 } 93 }
95} 94}
96 95
97
98
99
100
diff --git a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs
index b35a9d3..e526f73 100644
--- a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs
+++ b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs
@@ -30,6 +30,7 @@ using System.Collections.Generic;
30using System.Text; 30using System.Text;
31using libsecondlife; 31using libsecondlife;
32using libsecondlife.Packets; 32using libsecondlife.Packets;
33using OpenSim.Framework.Inventory;
33using OpenSim.Framework.Types; 34using OpenSim.Framework.Types;
34using OpenSim.Framework.Utilities; 35using OpenSim.Framework.Utilities;
35using OpenSim.Framework.Interfaces; 36using OpenSim.Framework.Interfaces;
@@ -352,7 +353,7 @@ namespace OpenSim.Region.ClientStack
352 // Console.WriteLine("upload request was for assetid: " + request.AssetBlock.TransactionID.Combine(this.SecureSessionID).ToStringHyphenated()); 353 // Console.WriteLine("upload request was for assetid: " + request.AssetBlock.TransactionID.Combine(this.SecureSessionID).ToStringHyphenated());
353 if (OnAssetUploadRequest != null) 354 if (OnAssetUploadRequest != null)
354 { 355 {
355 OnAssetUploadRequest(this, LLUUID.Combine(request.AssetBlock.TransactionID, this.SecureSessionID), request.AssetBlock.TransactionID, request.AssetBlock.Type, request.AssetBlock.AssetData, request.AssetBlock.StoreLocal); 356 OnAssetUploadRequest(this, request.AssetBlock.TransactionID.Combine(this.SecureSessionID), request.AssetBlock.TransactionID, request.AssetBlock.Type, request.AssetBlock.AssetData, request.AssetBlock.StoreLocal);
356 } 357 }
357 break; 358 break;
358 case PacketType.RequestXfer: 359 case PacketType.RequestXfer:
@@ -417,7 +418,7 @@ namespace OpenSim.Region.ClientStack
417 { 418 {
418 if (update.InventoryData[i].TransactionID != LLUUID.Zero) 419 if (update.InventoryData[i].TransactionID != LLUUID.Zero)
419 { 420 {
420 OnUpdateInventoryItem(this, update.InventoryData[i].TransactionID, LLUUID.Combine(update.InventoryData[i].TransactionID, this.SecureSessionID), update.InventoryData[i].ItemID); 421 OnUpdateInventoryItem(this, update.InventoryData[i].TransactionID, update.InventoryData[i].TransactionID.Combine(this.SecureSessionID), update.InventoryData[i].ItemID);
421 } 422 }
422 } 423 }
423 } 424 }
diff --git a/OpenSim/Region/ClientStack/ClientView.cs b/OpenSim/Region/ClientStack/ClientView.cs
index ecf78cb..2489739 100644
--- a/OpenSim/Region/ClientStack/ClientView.cs
+++ b/OpenSim/Region/ClientStack/ClientView.cs
@@ -37,6 +37,7 @@ using OpenSim.Framework;
37using OpenSim.Framework.Communications.Cache; 37using OpenSim.Framework.Communications.Cache;
38using OpenSim.Framework.Console; 38using OpenSim.Framework.Console;
39using OpenSim.Framework.Interfaces; 39using OpenSim.Framework.Interfaces;
40using OpenSim.Framework.Inventory;
40using OpenSim.Framework.Types; 41using OpenSim.Framework.Types;
41using OpenSim.Framework.Utilities; 42using OpenSim.Framework.Utilities;
42using Timer = System.Timers.Timer; 43using Timer = System.Timers.Timer;
diff --git a/OpenSim/Region/Communications/Local/CommunicationsLocal.cs b/OpenSim/Region/Communications/Local/CommunicationsLocal.cs
index 7e08297..a00b35f 100644
--- a/OpenSim/Region/Communications/Local/CommunicationsLocal.cs
+++ b/OpenSim/Region/Communications/Local/CommunicationsLocal.cs
@@ -107,7 +107,7 @@ namespace OpenSim.Region.Communications.Local
107 } 107 }
108 else 108 else
109 { 109 {
110 this.m_inventoryService.CreateNewUserInventory(LLUUID.Zero, userProf.UUID); 110 this.m_inventoryService.CreateNewUserInventory(userProf.UUID);
111 Console.WriteLine("Created new inventory set for " + firstName + " " + lastName); 111 Console.WriteLine("Created new inventory set for " + firstName + " " + lastName);
112 return userProf.UUID; 112 return userProf.UUID;
113 } 113 }
diff --git a/OpenSim/Region/Communications/Local/LocalInventoryService.cs b/OpenSim/Region/Communications/Local/LocalInventoryService.cs
index 5bd3277..53f6ffa 100644
--- a/OpenSim/Region/Communications/Local/LocalInventoryService.cs
+++ b/OpenSim/Region/Communications/Local/LocalInventoryService.cs
@@ -3,7 +3,6 @@ using libsecondlife;
3using OpenSim.Framework.Communications; 3using OpenSim.Framework.Communications;
4using OpenSim.Framework.Data; 4using OpenSim.Framework.Data;
5using InventoryFolder=OpenSim.Framework.Communications.Caches.InventoryFolder; 5using InventoryFolder=OpenSim.Framework.Communications.Caches.InventoryFolder;
6using InventoryCategory = OpenSim.Framework.Data.InventoryCategory;
7 6
8namespace OpenSim.Region.Communications.Local 7namespace OpenSim.Region.Communications.Local
9{ 8{
@@ -50,7 +49,7 @@ namespace OpenSim.Region.Communications.Local
50 } 49 }
51 } 50 }
52 51
53 public override void AddNewInventoryFolder(LLUUID userID, InventoryFolderBase folder) 52 public override void AddNewInventoryFolder(LLUUID userID, InventoryFolder folder)
54 { 53 {
55 this.AddFolder(folder); 54 this.AddFolder(folder);
56 } 55 }
diff --git a/OpenSim/Region/Communications/Local/LocalLoginService.cs b/OpenSim/Region/Communications/Local/LocalLoginService.cs
index 95fdf5a..ab8e397 100644
--- a/OpenSim/Region/Communications/Local/LocalLoginService.cs
+++ b/OpenSim/Region/Communications/Local/LocalLoginService.cs
@@ -7,6 +7,7 @@ using OpenSim.Framework.Data;
7using OpenSim.Framework.Types; 7using OpenSim.Framework.Types;
8using OpenSim.Framework.UserManagement; 8using OpenSim.Framework.UserManagement;
9using OpenSim.Framework.Utilities; 9using OpenSim.Framework.Utilities;
10using OpenSim.Framework.Inventory;
10 11
11namespace OpenSim.Region.Communications.Local 12namespace OpenSim.Region.Communications.Local
12{ 13{
@@ -24,7 +25,7 @@ namespace OpenSim.Region.Communications.Local
24 public event LoginToRegionEvent OnLoginToRegion; 25 public event LoginToRegionEvent OnLoginToRegion;
25 26
26 public LocalLoginService(UserManagerBase userManager, string welcomeMess, CommunicationsLocal parent, NetworkServersInfo serversInfo, bool authenticate) 27 public LocalLoginService(UserManagerBase userManager, string welcomeMess, CommunicationsLocal parent, NetworkServersInfo serversInfo, bool authenticate)
27 : base(userManager, parent.InventoryService, welcomeMess) 28 : base(userManager, welcomeMess)
28 { 29 {
29 m_Parent = parent; 30 m_Parent = parent;
30 this.serversInfo = serversInfo; 31 this.serversInfo = serversInfo;
@@ -52,7 +53,7 @@ namespace OpenSim.Region.Communications.Local
52 profile = this.m_userManager.GetUserProfile(firstname, lastname); 53 profile = this.m_userManager.GetUserProfile(firstname, lastname);
53 if (profile != null) 54 if (profile != null)
54 { 55 {
55 m_Parent.InventoryService.CreateNewUserInventory(LLUUID.Zero, profile.UUID); 56 m_Parent.InventoryService.CreateNewUserInventory(profile.UUID);
56 } 57 }
57 58
58 return profile; 59 return profile;
@@ -122,5 +123,51 @@ namespace OpenSim.Region.Communications.Local
122 } 123 }
123 124
124 } 125 }
126
127 protected override InventoryData CreateInventoryData(LLUUID userID)
128 {
129 List<InventoryFolderBase> folders = m_Parent.InventoryService.RequestFirstLevelFolders(userID);
130 if (folders.Count > 0)
131 {
132 LLUUID rootID = LLUUID.Zero;
133 ArrayList AgentInventoryArray = new ArrayList();
134 Hashtable TempHash;
135 foreach (InventoryFolderBase InvFolder in folders)
136 {
137 if (InvFolder.parentID == LLUUID.Zero)
138 {
139 rootID = InvFolder.folderID;
140 }
141 TempHash = new Hashtable();
142 TempHash["name"] = InvFolder.name;
143 TempHash["parent_id"] = InvFolder.parentID.ToStringHyphenated();
144 TempHash["version"] = (Int32)InvFolder.version;
145 TempHash["type_default"] = (Int32)InvFolder.type;
146 TempHash["folder_id"] = InvFolder.folderID.ToStringHyphenated();
147 AgentInventoryArray.Add(TempHash);
148 }
149 return new InventoryData(AgentInventoryArray, rootID);
150 }
151 else
152 {
153 AgentInventory userInventory = new AgentInventory();
154 userInventory.CreateRootFolder(userID, false);
155
156 ArrayList AgentInventoryArray = new ArrayList();
157 Hashtable TempHash;
158 foreach (OpenSim.Framework.Inventory.InventoryFolder InvFolder in userInventory.InventoryFolders.Values)
159 {
160 TempHash = new Hashtable();
161 TempHash["name"] = InvFolder.FolderName;
162 TempHash["parent_id"] = InvFolder.ParentID.ToStringHyphenated();
163 TempHash["version"] = (Int32)InvFolder.Version;
164 TempHash["type_default"] = (Int32)InvFolder.DefaultType;
165 TempHash["folder_id"] = InvFolder.FolderID.ToStringHyphenated();
166 AgentInventoryArray.Add(TempHash);
167 }
168
169 return new InventoryData(AgentInventoryArray, userInventory.InventoryRoot.FolderID);
170 }
171 }
125 } 172 }
126} 173}
diff --git a/OpenSim/Region/Communications/Local/LocalUserServices.cs b/OpenSim/Region/Communications/Local/LocalUserServices.cs
index 61b8633..3bc4301 100644
--- a/OpenSim/Region/Communications/Local/LocalUserServices.cs
+++ b/OpenSim/Region/Communications/Local/LocalUserServices.cs
@@ -1,5 +1,4 @@
1using System; 1using System;
2using libsecondlife;
3using OpenSim.Framework.Communications; 2using OpenSim.Framework.Communications;
4using OpenSim.Framework.Data; 3using OpenSim.Framework.Data;
5using OpenSim.Framework.Types; 4using OpenSim.Framework.Types;
@@ -49,10 +48,10 @@ namespace OpenSim.Region.Communications.Local
49 } 48 }
50 else 49 else
51 { 50 {
52 m_parent.InventoryService.CreateNewUserInventory(LLUUID.Zero, profile.UUID); 51 m_parent.InventoryService.CreateNewUserInventory(profile.UUID);
53 } 52 }
54 53
55 return profile; 54 return profile;
56 } 55 }
57 } 56 }
58} 57} \ No newline at end of file
diff --git a/OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs b/OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs
index 1aa6498..96f1933 100644
--- a/OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs
+++ b/OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs
@@ -14,8 +14,8 @@ namespace OpenSim.Region.Communications.OGS1
14 m_gridService = gridInterComms; 14 m_gridService = gridInterComms;
15 m_interRegion = gridInterComms; 15 m_interRegion = gridInterComms;
16 16
17 m_inventoryService = new OGS1InventoryService();
17 m_userService = new OGS1UserServices(this); 18 m_userService = new OGS1UserServices(this);
18 m_inventoryService = new OGS1InventoryService(serversInfo, m_userService);
19 } 19 }
20 } 20 }
21} 21}
diff --git a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
index 0b78c83..1b4b54c 100644
--- a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
+++ b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
@@ -5,7 +5,6 @@ using System.Net;
5using System.Runtime.Remoting; 5using System.Runtime.Remoting;
6using System.Runtime.Remoting.Channels; 6using System.Runtime.Remoting.Channels;
7using System.Runtime.Remoting.Channels.Tcp; 7using System.Runtime.Remoting.Channels.Tcp;
8using System.Runtime.Serialization.Formatters;
9using libsecondlife; 8using libsecondlife;
10using Nwc.XmlRpc; 9using Nwc.XmlRpc;
11using OpenSim.Framework; 10using OpenSim.Framework;
@@ -303,23 +302,8 @@ namespace OpenSim.Region.Communications.OGS1
303 /// </summary> 302 /// </summary>
304 private void StartRemoting() 303 private void StartRemoting()
305 { 304 {
306 // we only need to register the tcp channel once, and we don't know which other modules use remoting 305 TcpChannel ch = new TcpChannel(this.serversInfo.RemotingListenerPort);
307 if (ChannelServices.GetChannel("tcp") == null) 306 ChannelServices.RegisterChannel(ch, true);
308 {
309 // Creating a custom formatter for a TcpChannel sink chain.
310 BinaryServerFormatterSinkProvider serverProvider = new BinaryServerFormatterSinkProvider();
311 serverProvider.TypeFilterLevel = TypeFilterLevel.Full;
312
313 BinaryClientFormatterSinkProvider clientProvider = new BinaryClientFormatterSinkProvider();
314
315 IDictionary props = new Hashtable();
316 props["port"] = this.serversInfo.RemotingListenerPort;
317 props["typeFilterLevel"] = TypeFilterLevel.Full;
318
319 TcpChannel ch = new TcpChannel(props, clientProvider, serverProvider);
320
321 ChannelServices.RegisterChannel(ch, true);
322 }
323 307
324 WellKnownServiceTypeEntry wellType = new WellKnownServiceTypeEntry(typeof(OGS1InterRegionRemoting), "InterRegions", WellKnownObjectMode.Singleton); 308 WellKnownServiceTypeEntry wellType = new WellKnownServiceTypeEntry(typeof(OGS1InterRegionRemoting), "InterRegions", WellKnownObjectMode.Singleton);
325 RemotingConfiguration.RegisterWellKnownServiceType(wellType); 309 RemotingConfiguration.RegisterWellKnownServiceType(wellType);
diff --git a/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs b/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs
index 2ec4d10..45188c1 100644
--- a/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs
+++ b/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs
@@ -1,15 +1,8 @@
1using System;
2using System.Runtime.Remoting;
3using System.Runtime.Remoting.Channels;
4using System.Runtime.Remoting.Channels.Tcp;
5using System.Runtime.Serialization.Formatters;
6using System.Collections;
7using System.Collections.Generic; 1using System.Collections.Generic;
8
9using libsecondlife; 2using libsecondlife;
10using OpenSim.Framework.Communications; 3using OpenSim.Framework.Communications;
11using OpenSim.Framework.Data; 4using OpenSim.Framework.Data;
12using OpenSim.Framework.Types; 5using InventoryFolder = OpenSim.Framework.Communications.Caches.InventoryFolder;
13 6
14 7
15namespace OpenSim.Region.Communications.OGS1 8namespace OpenSim.Region.Communications.OGS1
@@ -17,83 +10,43 @@ namespace OpenSim.Region.Communications.OGS1
17 public class OGS1InventoryService : IInventoryServices 10 public class OGS1InventoryService : IInventoryServices
18 { 11 {
19 12
20 IUserServices _userServices; 13 public OGS1InventoryService()
21 IInventoryServices _inventoryServices;
22
23 public OGS1InventoryService(NetworkServersInfo networkConfig, IUserServices userServices) :
24 this(networkConfig.InventoryServerName, networkConfig.InventoryServerPort, userServices)
25 {
26 }
27
28 public OGS1InventoryService(string serverName, int serverPort, IUserServices userServices)
29 { 14 {
30 _userServices = userServices;
31
32 // we only need to register the tcp channel once, and we don't know which other modules use remoting
33 if (ChannelServices.GetChannel("tcp") == null)
34 {
35 // Creating a custom formatter for a TcpChannel sink chain.
36 BinaryServerFormatterSinkProvider serverProvider = new BinaryServerFormatterSinkProvider();
37 serverProvider.TypeFilterLevel = TypeFilterLevel.Full;
38
39 BinaryClientFormatterSinkProvider clientProvider = new BinaryClientFormatterSinkProvider();
40
41 IDictionary props = new Hashtable();
42 props["typeFilterLevel"] = TypeFilterLevel.Full;
43
44 // Pass the properties for the port setting and the server provider in the server chain argument. (Client remains null here.)
45 TcpChannel chan = new TcpChannel(props, clientProvider, serverProvider);
46
47 ChannelServices.RegisterChannel(chan, true);
48 }
49
50 15
51
52 string remotingUrl = string.Format("tcp://{0}:{1}/Inventory", serverName, serverPort);
53 _inventoryServices = (IInventoryServices)Activator.GetObject(typeof(IInventoryServices), remotingUrl);
54 } 16 }
55 17
56 #region IInventoryServices Members 18 #region IInventoryServices Members
57 19
58 public void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack, InventoryItemInfo itemCallBack) 20 public void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack, InventoryItemInfo itemCallBack)
59 { 21 {
60 _inventoryServices.RequestInventoryForUser(userID, folderCallBack, itemCallBack); 22
61 } 23 }
62 24
63 public void AddNewInventoryFolder(LLUUID userID, InventoryFolderBase folder) 25 public void AddNewInventoryFolder(LLUUID userID, InventoryFolder folder)
64 { 26 {
65 _inventoryServices.AddNewInventoryFolder(userID, folder); 27
66 } 28 }
67 29
68 public void AddNewInventoryItem(LLUUID userID, InventoryItemBase item) 30 public void AddNewInventoryItem(LLUUID userID, InventoryItemBase item)
69 { 31 {
70 _inventoryServices.AddNewInventoryItem(userID, item); 32
71 } 33 }
72 34
73 public void DeleteInventoryItem(LLUUID userID, InventoryItemBase item) 35 public void DeleteInventoryItem(LLUUID userID, InventoryItemBase item)
74 { 36 {
75 _inventoryServices.DeleteInventoryItem(userID, item); 37
76 }
77
78 public List<InventoryFolderBase> RequestFirstLevelFolders(LLUUID folderID)
79 {
80 return _inventoryServices.RequestFirstLevelFolders(folderID);
81 } 38 }
82 39
83 public List<InventoryItemBase> RequestFolderItems(LLUUID folderID) 40 public void CreateNewUserInventory(LLUUID user)
84 { 41 {
85 return _inventoryServices.RequestFolderItems(folderID); 42
86 } 43 }
87 44
88 public void GetRootFoldersForUser(LLUUID user, out LLUUID libraryFolder, out LLUUID personalFolder) 45 public List<InventoryFolderBase> RequestFirstLevelFolders(LLUUID userID)
89 { 46 {
90 _inventoryServices.GetRootFoldersForUser(user, out libraryFolder, out personalFolder); 47 return new List<InventoryFolderBase>();
91 } 48 }
92 49
93 public void CreateNewUserInventory(LLUUID libraryRootId, LLUUID user)
94 {
95 throw new Exception("method not implemented");
96 }
97 #endregion 50 #endregion
98 } 51 }
99} 52}
diff --git a/OpenSim/Region/Environment/Modules/ChatModule.cs b/OpenSim/Region/Environment/Modules/ChatModule.cs
index d76ffe3..1c7b806 100644
--- a/OpenSim/Region/Environment/Modules/ChatModule.cs
+++ b/OpenSim/Region/Environment/Modules/ChatModule.cs
@@ -162,7 +162,7 @@ namespace OpenSim.Region.Environment.Modules
162 avatar = m_scene.GetScenePresence(presence.ControllingClient.AgentId); 162 avatar = m_scene.GetScenePresence(presence.ControllingClient.AgentId);
163 if (avatar != null) 163 if (avatar != null)
164 { 164 {
165 dis = (int)LLVector3.Mag(avatar.AbsolutePosition-fromPos); 165 dis = (int) avatar.AbsolutePosition.GetDistanceTo(fromPos);
166 } 166 }
167 167
168 switch (type) 168 switch (type)
@@ -211,4 +211,4 @@ namespace OpenSim.Region.Environment.Modules
211 } 211 }
212 } 212 }
213 } 213 }
214} 214} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
index 5b6fe46..e6b8364 100644
--- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
@@ -561,7 +561,7 @@ namespace OpenSim.Region.Environment.Scenes
561 } 561 }
562 562
563 /// check for physics-related movement 563 /// check for physics-related movement
564 else if (LLVector3.Dist(lastPhysPos,AbsolutePosition) > 0.02) 564 else if (lastPhysPos.GetDistanceTo(AbsolutePosition) > 0.02)
565 { 565 {
566 SendTerseUpdateToAllClients(); 566 SendTerseUpdateToAllClients();
567 m_updateCount = 0; 567 m_updateCount = 0;
@@ -748,7 +748,7 @@ namespace OpenSim.Region.Environment.Scenes
748 748
749 protected void CheckForSignificantMovement() 749 protected void CheckForSignificantMovement()
750 { 750 {
751 if (LLVector3.Dist(AbsolutePosition, posLastSignificantMove) > 2.0) 751 if (Helpers.VecDist(AbsolutePosition, posLastSignificantMove) > 2.0)
752 { 752 {
753 posLastSignificantMove = AbsolutePosition; 753 posLastSignificantMove = AbsolutePosition;
754 if (OnSignificantClientMovement != null) 754 if (OnSignificantClientMovement != null)
@@ -919,4 +919,4 @@ namespace OpenSim.Region.Environment.Scenes
919 RemoveFromPhysicalScene(); 919 RemoveFromPhysicalScene();
920 } 920 }
921 } 921 }
922} 922} \ No newline at end of file
diff --git a/bin/Inventory_Default.xml b/bin/Inventory_Default.xml
deleted file mode 100644
index cbbb8e3..0000000
--- a/bin/Inventory_Default.xml
+++ /dev/null
@@ -1,62 +0,0 @@
1<?xml version="1.0" encoding="utf-8"?>
2<inventory>
3 <folder>
4 <name>My Inventory</name>
5 <folderID UUID="00000112-000f-0000-0000-000100bba000" />
6 <type>9</type>
7 <folders>
8 <folder>
9 <name>Animations</name>
10 <type>20</type>
11 </folder>
12 <folder>
13 <name>Body Parts</name>
14 <type>13</type>
15 </folder>
16 <folder>
17 <name>Clothing</name>
18 <type>5</type>
19 </folder>
20 <folder>
21 <name>Gestures</name>
22 <type>21</type>
23 </folder>
24 <folder>
25 <name>Landmarks</name>
26 <type>3</type>
27 </folder>
28 <folder>
29 <name>Lost And Found</name>
30 <type>16</type>
31 </folder>
32 <folder>
33 <name>Notecards</name>
34 <type>7</type>
35 </folder>
36 <folder>
37 <name>Objects</name>
38 <type>6</type>
39 </folder>
40 <folder>
41 <name>Photo Album</name>
42 <type>15</type>
43 </folder>
44 <folder>
45 <name>Scripts</name>
46 <type>10</type>
47 </folder>
48 <folder>
49 <name>Sounds</name>
50 <type>1</type>
51 </folder>
52 <folder>
53 <name>Textures</name>
54 <type>0</type>
55 </folder>
56 <folder>
57 <name>Trash</name>
58 <type>14</type>
59 </folder>
60 </folders>
61 </folder>
62</inventory> \ No newline at end of file
diff --git a/bin/Inventory_Library.xml b/bin/Inventory_Library.xml
deleted file mode 100644
index f54cc12..0000000
--- a/bin/Inventory_Library.xml
+++ /dev/null
@@ -1,63 +0,0 @@
1<?xml version="1.0" encoding="utf-8"?>
2<inventory>
3 <folder>
4 <name>Library</name>
5 <folderid UUID="00000112-000f-0000-0000-000100bba000" />
6 <type>9</type>
7 <folders>
8 <folder>
9 <name>Animations</name>
10 <type>20</type>
11 </folder>
12 <folder>
13 <name>Body Parts</name>
14 <type>13</type>
15 </folder>
16 <folder>
17 <name>Clothing</name>
18 <type>5</type>
19 </folder>
20 <folder>
21 <name>Gestures</name>
22 <type>21</type>
23 </folder>
24 <folder>
25 <name>Landmarks</name>
26 <type>3</type>
27 </folder>
28 <folder>
29 <name>Lost And Found</name>
30 <type>3</type>
31 </folder>
32 <folder>
33 <name>Notecards</name>
34 <type>7</type>
35 </folder>
36 <folder>
37 <name>Objects</name>
38 <type>6</type>
39 </folder>
40 <folder>
41 <name>Photo Album</name>
42 <type>15</type>
43 </folder>
44 <folder>
45 <name>Scripts</name>
46 <type>10</type>
47 </folder>
48 <folder>
49 <name>Sounds</name>
50 <type>1</type>
51 </folder>
52 <folder>
53 <name>Textures</name>
54 <type>0</type>
55 </folder>
56
57 <folder>
58 <name>Accessories</name>
59 <type>8</type>
60 </folder>
61 </folders>
62 </folder>
63</inventory> \ No newline at end of file
diff --git a/bin/libsecondlife.dll b/bin/libsecondlife.dll
index b9741bc..8b9596d 100644
--- a/bin/libsecondlife.dll
+++ b/bin/libsecondlife.dll
Binary files differ
diff --git a/prebuild.xml b/prebuild.xml
index 4222832..bbd403c 100644
--- a/prebuild.xml
+++ b/prebuild.xml
@@ -823,38 +823,6 @@
823 <Reference name="OpenSim.Framework"/> 823 <Reference name="OpenSim.Framework"/>
824 <Reference name="OpenSim.Framework.Console"/> 824 <Reference name="OpenSim.Framework.Console"/>
825 <Reference name="OpenSim.Framework.Communications"/> 825 <Reference name="OpenSim.Framework.Communications"/>
826 <Reference name="OpenSim.Region.Communications.OGS1"/>
827 <Reference name="OpenSim.Framework.Data"/>
828 <Reference name="OpenSim.Framework.Servers"/>
829 <Reference name="libsecondlife.dll"/>
830 <Reference name="Db4objects.Db4o.dll"/>
831 <Reference name="XMLRPC.dll"/>
832
833 <Files>
834 <Match pattern="*.cs" recurse="true"/>
835 </Files>
836 </Project>
837
838 <Project name="OpenSim.Grid.InventoryServer" path="OpenSim/Grid/InventoryServer" type="Exe">
839 <Configuration name="Debug">
840 <Options>
841 <OutputPath>../../../bin/</OutputPath>
842 </Options>
843 </Configuration>
844 <Configuration name="Release">
845 <Options>
846 <OutputPath>../../../bin/</OutputPath>
847 </Options>
848 </Configuration>
849
850 <ReferencePath>../../../bin/</ReferencePath>
851 <Reference name="System" localCopy="false"/>
852 <Reference name="System.Data" localCopy="false"/>
853 <Reference name="System.Xml" localCopy="false"/>
854 <Reference name="System.Runtime.Remoting" localCopy="false"/>
855 <Reference name="OpenSim.Framework"/>
856 <Reference name="OpenSim.Framework.Console"/>
857 <Reference name="OpenSim.Framework.Communications"/>
858 <Reference name="OpenSim.Framework.Data"/> 826 <Reference name="OpenSim.Framework.Data"/>
859 <Reference name="OpenSim.Framework.Servers"/> 827 <Reference name="OpenSim.Framework.Servers"/>
860 <Reference name="libsecondlife.dll"/> 828 <Reference name="libsecondlife.dll"/>
@@ -1013,7 +981,3 @@
1013</Prebuild> 981</Prebuild>
1014 982
1015 983
1016
1017
1018
1019
diff --git a/share/sql/mysql-inventoryfolders.sql b/share/sql/mysql-inventoryfolders.sql
index ebda3bb..8704702 100644
--- a/share/sql/mysql-inventoryfolders.sql
+++ b/share/sql/mysql-inventoryfolders.sql
@@ -3,8 +3,6 @@ CREATE TABLE `inventoryfolders` (
3 `agentID` varchar(36) default NULL, 3 `agentID` varchar(36) default NULL,
4 `parentFolderID` varchar(36) default NULL, 4 `parentFolderID` varchar(36) default NULL,
5 `folderName` varchar(64) default NULL, 5 `folderName` varchar(64) default NULL,
6 `category` TINYINT NOT NULL,
7 `folderType` TINYINT NOT NULL,
8 PRIMARY KEY (`folderID`), 6 PRIMARY KEY (`folderID`),
9 KEY `owner` (`agentID`), 7 KEY `owner` (`agentID`),
10 KEY `parent` (`parentFolderID`) 8 KEY `parent` (`parentFolderID`)