aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Communications/LoginService.cs
diff options
context:
space:
mode:
authorlbsa712007-09-27 13:25:45 +0000
committerlbsa712007-09-27 13:25:45 +0000
commit8143c597fc5f62ec0d931d2d5b887730e06aec04 (patch)
treeae67873a5f801b2b7bdf9a7b088db98beb97b5ac /OpenSim/Framework/Communications/LoginService.cs
parentTerrain: (diff)
downloadopensim-SC_OLD-8143c597fc5f62ec0d931d2d5b887730e06aec04.zip
opensim-SC_OLD-8143c597fc5f62ec0d931d2d5b887730e06aec04.tar.gz
opensim-SC_OLD-8143c597fc5f62ec0d931d2d5b887730e06aec04.tar.bz2
opensim-SC_OLD-8143c597fc5f62ec0d931d2d5b887730e06aec04.tar.xz
* Tleiades grid mode inventory (#444) - thanx Tleiades!
* updated to rev 1413 on libsecondlife.dll and libsecondlife.dll.config (#423)
Diffstat (limited to 'OpenSim/Framework/Communications/LoginService.cs')
-rw-r--r--OpenSim/Framework/Communications/LoginService.cs134
1 files changed, 55 insertions, 79 deletions
diff --git a/OpenSim/Framework/Communications/LoginService.cs b/OpenSim/Framework/Communications/LoginService.cs
index 8e7cf80..64e323d 100644
--- a/OpenSim/Framework/Communications/LoginService.cs
+++ b/OpenSim/Framework/Communications/LoginService.cs
@@ -8,11 +8,10 @@ using Nwc.XmlRpc;
8using OpenSim.Framework.Console; 8using OpenSim.Framework.Console;
9using OpenSim.Framework.Data; 9using OpenSim.Framework.Data;
10using OpenSim.Framework.Interfaces; 10using OpenSim.Framework.Interfaces;
11using OpenSim.Framework.Inventory;
12using OpenSim.Framework.Utilities; 11using OpenSim.Framework.Utilities;
13 12using OpenSim.Framework.Communications;
14using OpenSim.Framework.Configuration; 13using OpenSim.Framework.Configuration;
15using InventoryFolder = OpenSim.Framework.Inventory.InventoryFolder; 14
16 15
17namespace OpenSim.Framework.UserManagement 16namespace OpenSim.Framework.UserManagement
18{ 17{
@@ -20,10 +19,12 @@ namespace OpenSim.Framework.UserManagement
20 { 19 {
21 protected string m_welcomeMessage = "Welcome to OpenSim"; 20 protected string m_welcomeMessage = "Welcome to OpenSim";
22 protected UserManagerBase m_userManager = null; 21 protected UserManagerBase m_userManager = null;
22 protected IInventoryServices m_inventoryServer = null;
23 23
24 public LoginService(UserManagerBase userManager, string welcomeMess) 24 public LoginService(UserManagerBase userManager, IInventoryServices inventoryServer, string welcomeMess)
25 { 25 {
26 m_userManager = userManager; 26 m_userManager = userManager;
27 m_inventoryServer = inventoryServer;
27 if (welcomeMess != "") 28 if (welcomeMess != "")
28 { 29 {
29 m_welcomeMessage = welcomeMess; 30 m_welcomeMessage = welcomeMess;
@@ -37,7 +38,6 @@ namespace OpenSim.Framework.UserManagement
37 /// <returns>The response to send</returns> 38 /// <returns>The response to send</returns>
38 public XmlRpcResponse XmlRpcLoginMethod(XmlRpcRequest request) 39 public XmlRpcResponse XmlRpcLoginMethod(XmlRpcRequest request)
39 { 40 {
40
41 System.Console.WriteLine("Attempting login now..."); 41 System.Console.WriteLine("Attempting login now...");
42 XmlRpcResponse response = new XmlRpcResponse(); 42 XmlRpcResponse response = new XmlRpcResponse();
43 Hashtable requestData = (Hashtable)request.Params[0]; 43 Hashtable requestData = (Hashtable)request.Params[0];
@@ -85,15 +85,41 @@ namespace OpenSim.Framework.UserManagement
85 { 85 {
86 LLUUID agentID = userProfile.UUID; 86 LLUUID agentID = userProfile.UUID;
87 87
88 // Inventory Library Section 88 LLUUID libraryFolderID;
89 InventoryData inventData = this.CreateInventoryData(agentID); 89 LLUUID personalFolderID;
90 ArrayList AgentInventoryArray = inventData.InventoryArray; 90
91 m_inventoryServer.GetRootFoldersForUser(agentID, out libraryFolderID, out personalFolderID);
92 if (personalFolderID == LLUUID.Zero)
93 {
94 m_inventoryServer.CreateNewUserInventory(libraryFolderID, agentID);
95 m_inventoryServer.GetRootFoldersForUser(agentID, out libraryFolderID, out personalFolderID);
96 }
97
98 // The option "inventory-lib-owner" requires that we return the id of the
99 // owner of the library inventory.
100 Hashtable dynamicStruct = new Hashtable();
101 dynamicStruct["agent_id"] = libraryFolderID.ToStringHyphenated();
102 logResponse.InventoryLibraryOwner.Add(dynamicStruct);
103
104 // The option "inventory-lib-root" requires that we return the id of the
105 // root folder of the library inventory.
106 dynamicStruct = new Hashtable();
107 dynamicStruct["folder_id"] = libraryFolderID.ToStringHyphenated();
108 logResponse.InventoryLibraryRoot.Add(dynamicStruct);
91 109
92 Hashtable InventoryRootHash = new Hashtable(); 110 // The option "inventory-root" requires that we return the id of the
93 InventoryRootHash["folder_id"] = inventData.RootFolderID.ToStringHyphenated(); 111 // root folder of the users inventory.
94 ArrayList InventoryRoot = new ArrayList(); 112 dynamicStruct = new Hashtable();
95 InventoryRoot.Add(InventoryRootHash); 113 dynamicStruct["folder_id"] = personalFolderID.ToStringHyphenated();
96 userProfile.rootInventoryFolderID = inventData.RootFolderID; 114 logResponse.InventoryRoot.Add(dynamicStruct);
115
116 // The option "inventory-skeleton" requires that we return the structure of the
117 // users folder hierachy
118 logResponse.InventorySkeleton = GetInventorySkeleton(personalFolderID);
119
120 // The option "inventory-skel-lib" requires that we return the structure of the
121 // library folder hierachy
122 logResponse.InventoryLibrarySkeleton = GetInventorySkeleton(libraryFolderID);
97 123
98 // Circuit Code 124 // Circuit Code
99 uint circode = (uint)(Util.RandomClass.Next()); 125 uint circode = (uint)(Util.RandomClass.Next());
@@ -103,10 +129,6 @@ namespace OpenSim.Framework.UserManagement
103 logResponse.AgentID = agentID.ToStringHyphenated(); 129 logResponse.AgentID = agentID.ToStringHyphenated();
104 logResponse.SessionID = userProfile.currentAgent.sessionID.ToStringHyphenated(); 130 logResponse.SessionID = userProfile.currentAgent.sessionID.ToStringHyphenated();
105 logResponse.SecureSessionID = userProfile.currentAgent.secureSessionID.ToStringHyphenated(); 131 logResponse.SecureSessionID = userProfile.currentAgent.secureSessionID.ToStringHyphenated();
106 logResponse.InventoryRoot = InventoryRoot;
107 logResponse.InventorySkeleton = AgentInventoryArray;
108 logResponse.InventoryLibrary = this.GetInventoryLibrary();
109 logResponse.InventoryLibraryOwner = this.GetLibraryOwner();
110 logResponse.CircuitCode = (Int32)circode; 132 logResponse.CircuitCode = (Int32)circode;
111 //logResponse.RegionX = 0; //overwritten 133 //logResponse.RegionX = 0; //overwritten
112 //logResponse.RegionY = 0; //overwritten 134 //logResponse.RegionY = 0; //overwritten
@@ -212,76 +234,30 @@ namespace OpenSim.Framework.UserManagement
212 } 234 }
213 235
214 /// <summary> 236 /// <summary>
215 /// 237 /// Create a structure of the generic inventory structure of a specified folder
216 /// </summary>
217 /// <returns></returns>
218 protected virtual ArrayList GetInventoryLibrary()
219 {
220 //return new ArrayList();
221 Hashtable TempHash = new Hashtable();
222 TempHash["name"] = "OpenSim Library";
223 TempHash["parent_id"] = LLUUID.Zero.ToStringHyphenated();
224 TempHash["version"] = 1;
225 TempHash["type_default"] = -1;
226 TempHash["folder_id"] = "00000112-000f-0000-0000-000100bba000";
227 ArrayList temp = new ArrayList();
228 temp.Add(TempHash);
229
230 TempHash = new Hashtable();
231 TempHash["name"] = "Texture Library";
232 TempHash["parent_id"] = "00000112-000f-0000-0000-000100bba000";
233 TempHash["version"] = 1;
234 TempHash["type_default"] = -1;
235 TempHash["folder_id"] = "00000112-000f-0000-0000-000100bba001";
236 temp.Add(TempHash);
237 return temp;
238 }
239
240 /// <summary>
241 ///
242 /// </summary> 238 /// </summary>
243 /// <returns></returns> 239 /// <returns></returns>
244 protected virtual ArrayList GetLibraryOwner() 240 protected virtual ArrayList GetInventorySkeleton(LLUUID folderID)
245 { 241 {
246 //for now create random inventory library owner
247 Hashtable TempHash = new Hashtable();
248 TempHash["agent_id"] = "11111111-1111-0000-0000-000100bba000";
249 ArrayList inventoryLibOwner = new ArrayList();
250 inventoryLibOwner.Add(TempHash);
251 return inventoryLibOwner;
252 }
253 242
254 protected virtual InventoryData CreateInventoryData(LLUUID userID) 243 List<InventoryFolderBase> folders = m_inventoryServer.RequestFirstLevelFolders(folderID);
255 {
256 AgentInventory userInventory = new AgentInventory();
257 userInventory.CreateRootFolder(userID, false);
258 244
259 ArrayList AgentInventoryArray = new ArrayList(); 245 ArrayList temp = new ArrayList();
260 Hashtable TempHash; 246 foreach (InventoryFolderBase ifb in folders)
261 foreach (InventoryFolder InvFolder in userInventory.InventoryFolders.Values)
262 { 247 {
263 TempHash = new Hashtable(); 248 LLUUID tempFolderID = ifb.folderID;
264 TempHash["name"] = InvFolder.FolderName; 249 LLUUID tempParentID = ifb.parentID;
265 TempHash["parent_id"] = InvFolder.ParentID.ToStringHyphenated(); 250
266 TempHash["version"] = (Int32)InvFolder.Version; 251 Hashtable TempHash = new Hashtable();
267 TempHash["type_default"] = (Int32)InvFolder.DefaultType; 252 TempHash["folder_id"] = tempFolderID.ToStringHyphenated();
268 TempHash["folder_id"] = InvFolder.FolderID.ToStringHyphenated(); 253 TempHash["name"] = ifb.name;
269 AgentInventoryArray.Add(TempHash); 254 TempHash["parent_id"] = tempParentID.ToStringHyphenated();
255 TempHash["type_default"] = ifb.type;
256 TempHash["version"] = ifb.version+1;
257 temp.Add(TempHash);
270 } 258 }
271 259
272 return new InventoryData(AgentInventoryArray, userInventory.InventoryRoot.FolderID); 260 return temp;
273 }
274
275 public class InventoryData
276 {
277 public ArrayList InventoryArray = null;
278 public LLUUID RootFolderID = LLUUID.Zero;
279
280 public InventoryData(ArrayList invList, LLUUID rootID)
281 {
282 InventoryArray = invList;
283 RootFolderID = rootID;
284 }
285 } 261 }
286 } 262 }
287} 263}