diff --git a/OpenGridServices.GridServer/SimProfiles.cs b/OpenGridServices.GridServer/SimProfiles.cs index 5e02b4f3da..7fcfb8c3cd 100644 --- a/OpenGridServices.GridServer/SimProfiles.cs +++ b/OpenGridServices.GridServer/SimProfiles.cs @@ -168,13 +168,15 @@ namespace OpenGridServices.GridServer } } - responseData["UUID"] = TheSim.UUID; + responseData["UUID"] = TheSim.UUID.ToString(); responseData["region_locx"] = TheSim.RegionLocX.ToString(); responseData["region_locy"] = TheSim.RegionLocY.ToString(); responseData["regionname"] = TheSim.regionname; responseData["estate_id"] = "1"; responseData["neighbours"] = SimNeighboursData; - + + responseData["sim_ip"] = TheSim.sim_ip; + responseData["sim_port"] = TheSim.sim_port.ToString(); responseData["asset_url"] = m_gridManager.Cfg.DefaultAssetServer; responseData["asset_sendkey"] = m_gridManager.Cfg.AssetSendKey; responseData["asset_recvkey"] = m_gridManager.Cfg.AssetRecvKey; diff --git a/OpenSim.Framework/AgentInventory.cs b/OpenSim.Framework/AgentInventory.cs index 9919ec3d90..f715129490 100644 --- a/OpenSim.Framework/AgentInventory.cs +++ b/OpenSim.Framework/AgentInventory.cs @@ -12,7 +12,7 @@ namespace OpenSim.Framework.Inventory //Holds the local copy of Inventory info for a agent public Dictionary InventoryFolders; public Dictionary InventoryItems; - public InventoryFolder InventoryRoot = new InventoryFolder(); + public InventoryFolder InventoryRoot; public int LastCached; //maybe used by opensim app, time this was last stored/compared to user server public LLUUID AgentID; public AvatarWearable[] Wearables; @@ -31,15 +31,7 @@ namespace OpenSim.Framework.Inventory { Wearables[i] = new AvatarWearable(); } - - InventoryRoot = new InventoryFolder(); - InventoryRoot.FolderID = LLUUID.Random(); - InventoryRoot.ParentID = LLUUID.Zero; - InventoryRoot.Version = 1; - InventoryRoot.DefaultType = 8; - InventoryRoot.OwnerID = this.AgentID; - InventoryRoot.FolderName = "My Inventory"; - InventoryFolders.Add(InventoryRoot.FolderID, InventoryRoot); + } public bool CreateNewFolder(LLUUID folderID, ushort type) @@ -55,14 +47,14 @@ namespace OpenSim.Framework.Inventory public void CreateRootFolder(LLUUID newAgentID, bool createTextures) { this.AgentID = newAgentID; - /* InventoryRoot = new InventoryFolder(); + InventoryRoot = new InventoryFolder(); InventoryRoot.FolderID = LLUUID.Random(); InventoryRoot.ParentID = new LLUUID(); InventoryRoot.Version = 1; InventoryRoot.DefaultType = 8; InventoryRoot.OwnerID = this.AgentID; InventoryRoot.FolderName = "My Inventory-"; - InventoryFolders.Add(InventoryRoot.FolderID, InventoryRoot);*/ + InventoryFolders.Add(InventoryRoot.FolderID, InventoryRoot); InventoryRoot.OwnerID = this.AgentID; if (createTextures) { diff --git a/OpenSim.Framework/SimProfile.cs b/OpenSim.Framework/SimProfile.cs index fd130f084f..ed34863886 100644 --- a/OpenSim.Framework/SimProfile.cs +++ b/OpenSim.Framework/SimProfile.cs @@ -25,15 +25,15 @@ namespace OpenSim.Framework.Sims Hashtable RespData = (Hashtable)GridResp.Value; this.UUID = new LLUUID((string)RespData["UUID"]); - this.regionhandle = (ulong)Convert.ToUInt64(RespData["regionhandle"]); + this.regionhandle = Helpers.UIntsToLong((997 * 256), (996 * 256)); this.regionname = (string)RespData["regionname"]; this.sim_ip = (string)RespData["sim_ip"]; this.sim_port = (uint)Convert.ToUInt16(RespData["sim_port"]); - this.caps_url = (string)RespData["caps_url"]; - this.RegionLocX = (uint)Convert.ToUInt32(RespData["RegionLocX"]); - this.RegionLocY = (uint)Convert.ToUInt32(RespData["RegionLocY"]); - this.sendkey = (string)RespData["sendkey"]; - this.recvkey = (string)RespData["recvkey"]; + this.caps_url = "http://" + ((string)RespData["sim_ip"]) + ":" + (string)RespData["sim_port"] + "/"; + this.RegionLocX = (uint)Convert.ToUInt32(RespData["region_locx"]); + this.RegionLocY = (uint)Convert.ToUInt32(RespData["region_locy"]); + this.sendkey = SendKey; + this.recvkey = RecvKey; } catch (Exception e) { @@ -48,7 +48,6 @@ namespace OpenSim.Framework.Sims { Hashtable GridReqParams = new Hashtable(); GridReqParams["UUID"] = UUID.ToString(); - GridReqParams["caller"] = "userserver"; GridReqParams["authkey"] = SendKey; ArrayList SendParams = new ArrayList(); SendParams.Add(GridReqParams); @@ -58,15 +57,15 @@ namespace OpenSim.Framework.Sims Hashtable RespData = (Hashtable)GridResp.Value; this.UUID = new LLUUID((string)RespData["UUID"]); - this.regionhandle = (ulong)Convert.ToUInt64(RespData["regionhandle"]); + this.regionhandle = Helpers.UIntsToLong((997 * 256), (996 * 256)); this.regionname = (string)RespData["regionname"]; this.sim_ip = (string)RespData["sim_ip"]; this.sim_port = (uint)Convert.ToUInt16(RespData["sim_port"]); - this.caps_url = (string)RespData["caps_url"]; - this.RegionLocX = (uint)Convert.ToUInt32(RespData["RegionLocX"]); - this.RegionLocY = (uint)Convert.ToUInt32(RespData["RegionLocY"]); - this.sendkey = (string)RespData["sendkey"]; - this.recvkey = (string)RespData["recvkey"]; + this.caps_url = "http://" + ((string)RespData["sim_ip"]) + ":" + (string)RespData["sim_port"] + "/"; + this.RegionLocX = (uint)Convert.ToUInt32(RespData["region_locx"]); + this.RegionLocY = (uint)Convert.ToUInt32(RespData["region_locy"]); + this.sendkey = SendKey; + this.recvkey = RecvKey; } catch (Exception e) { diff --git a/OpenSim.Framework/UserProfile.cs b/OpenSim.Framework/UserProfile.cs index 215f7da1ef..04e9fd54c7 100644 --- a/OpenSim.Framework/UserProfile.cs +++ b/OpenSim.Framework/UserProfile.cs @@ -31,8 +31,9 @@ namespace OpenSim.Framework.User { Circuits = new Dictionary(); Inventory = new AgentInventory(); - homeregionhandle = Helpers.UIntsToLong((997 * 256), (996 * 256)); ; - + homeregionhandle = Helpers.UIntsToLong((997 * 256), (996 * 256)); + homepos = new LLVector3(); + homelookat = new LLVector3(); } public void InitSessionData() diff --git a/OpenSim.Framework/UserProfileManager.cs b/OpenSim.Framework/UserProfileManager.cs index 7c4fb6f194..a44342c170 100644 --- a/OpenSim.Framework/UserProfileManager.cs +++ b/OpenSim.Framework/UserProfileManager.cs @@ -106,7 +106,7 @@ namespace OpenSim.Framework.User LLUUID AgentID = TheUser.UUID; TheUser.InitSessionData(); - + //for loading data from a grid server, make any changes in CustomiseResponse() (or create a sub class of this and override that method) //SimProfile SimInfo = new SimProfile(); //SimInfo = SimInfo.LoadFromGrid(TheUser.homeregionhandle, GridURL, GridSendKey, GridRecvKey); @@ -138,11 +138,12 @@ namespace OpenSim.Framework.User ArrayList ClassifiedCategories = new ArrayList(); ClassifiedCategories.Add(ClassifiedCategoriesHash); - ArrayList AgentInventory = new ArrayList(); + ArrayList AgentInventory = new ArrayList(); Console.WriteLine("adding inventory to response"); + Hashtable TempHash; foreach (InventoryFolder InvFolder in TheUser.Inventory.InventoryFolders.Values) { - Hashtable TempHash = new Hashtable(); + TempHash = new Hashtable(); Console.WriteLine("adding folder " + InvFolder.FolderName + ", ID: " + InvFolder.FolderID.ToStringHyphenated() + " with parent: " + InvFolder.ParentID.ToStringHyphenated()); TempHash["name"] = InvFolder.FolderName; TempHash["parent_id"] = InvFolder.ParentID.ToStringHyphenated(); @@ -192,14 +193,15 @@ namespace OpenSim.Framework.User responseData["agent_id"] = AgentID.ToStringHyphenated(); responseData["region_y"] = (Int32)996 * 256; // (Int32)SimInfo.RegionLocY * 256; responseData["region_x"] = (Int32)997 * 256; //SimInfo.RegionLocX * 256; - responseData["seed_capability"] = null; + responseData["seed_capability"] = ""; responseData["agent_access"] = "M"; responseData["session_id"] = TheUser.CurrentSessionID.ToStringHyphenated(); responseData["login"] = "true"; this.CustomiseResponse(ref responseData, TheUser); response.Value = responseData; - // TheUser.SendDataToSim(SimInfo); + // TheUser.SendDataToSim(SimInfo); + return response; } catch (Exception E) @@ -209,6 +211,7 @@ namespace OpenSim.Framework.User //} } return response; + } private static XmlRpcResponse CreateErrorConnectingToGridResponse() @@ -236,13 +239,13 @@ namespace OpenSim.Framework.User public virtual void CustomiseResponse(ref Hashtable response, UserProfile theUser) { //default method set up to act as ogs user server - SimProfile SimInfo = new SimProfile(); + SimProfile SimInfo= new SimProfile(); //get siminfo from grid server SimInfo = SimInfo.LoadFromGrid(theUser.homeregionhandle, GridURL, GridSendKey, GridRecvKey); - Int32 circode = (Int32)response["circuit_code"]; + Int32 circode = (Int32)Convert.ToUInt32(response["circuit_code"]); theUser.AddSimCircuit((uint)circode, SimInfo.UUID); response["home"] = "{'region_handle':[r" + (SimInfo.RegionLocX * 256).ToString() + ",r" + (SimInfo.RegionLocY * 256).ToString() + "], 'position':[r" + theUser.homepos.X.ToString() + ",r" + theUser.homepos.Y.ToString() + ",r" + theUser.homepos.Z.ToString() + "], 'look_at':[r" + theUser.homelookat.X.ToString() + ",r" + theUser.homelookat.Y.ToString() + ",r" + theUser.homelookat.Z.ToString() + "]}"; - response["sim_ip"] = SimInfo.sim_ip.ToString(); + response["sim_ip"] = SimInfo.sim_ip; response["sim_port"] = (Int32)SimInfo.sim_port; response["region_y"] = (Int32)SimInfo.RegionLocY * 256; response["region_x"] = (Int32)SimInfo.RegionLocX * 256; @@ -255,7 +258,7 @@ namespace OpenSim.Framework.User SimParams["firstname"] = theUser.firstname; SimParams["lastname"] = theUser.lastname; SimParams["agent_id"] = theUser.UUID.ToString(); - SimParams["circuit_code"] = (Int32)theUser.Circuits[SimInfo.UUID]; + SimParams["circuit_code"] = (Int32)circode; ArrayList SendParams = new ArrayList(); SendParams.Add(SimParams); diff --git a/OpenSim.Framework/UserProfileManagerBase.cs b/OpenSim.Framework/UserProfileManagerBase.cs index 44288315a1..c9fbf4cf49 100644 --- a/OpenSim.Framework/UserProfileManagerBase.cs +++ b/OpenSim.Framework/UserProfileManagerBase.cs @@ -52,7 +52,7 @@ namespace OpenSim.Framework.User { foreach (libsecondlife.LLUUID UUID in UserProfiles.Keys) { - if ((UserProfiles[UUID].firstname == firstname) && (UserProfiles[UUID].lastname == lastname)) + if (UserProfiles[UUID].firstname.Equals(firstname)) if (UserProfiles[UUID].lastname.Equals(lastname)) { return UserProfiles[UUID]; } @@ -73,7 +73,7 @@ namespace OpenSim.Framework.User { if (TheUser.MD5passwd == passwd) { - Console.WriteLine("UserProfile - authorised "); + Console.WriteLine("UserProfile - authorised " + firstname + " " + lastname); return true; } else @@ -103,8 +103,7 @@ namespace OpenSim.Framework.User newprofile.firstname = firstname; newprofile.lastname = lastname; newprofile.MD5passwd = MD5passwd; - newprofile.UUID = LLUUID.Random(); - newprofile.Inventory.CreateRootFolder(newprofile.UUID, true); + newprofile.UUID = LLUUID.Random(); newprofile.Inventory.CreateRootFolder(newprofile.UUID, true); this.UserProfiles.Add(newprofile.UUID, newprofile); return newprofile; } diff --git a/OpenUser.Config/UserConfigDb4o/DbUserConfig.cs b/OpenUser.Config/UserConfigDb4o/DbUserConfig.cs index 39f1adca8a..fd349db91c 100644 --- a/OpenUser.Config/UserConfigDb4o/DbUserConfig.cs +++ b/OpenUser.Config/UserConfigDb4o/DbUserConfig.cs @@ -83,7 +83,7 @@ namespace OpenUser.Config.UserConfigDb4o OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Default startup message: " + this.DefaultStartupMsg); OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Grid server URL: " + this.GridServerURL); OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Key to send to grid: " + this.GridSendKey); - OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Key to expect from sims: " + this.GridRecvKey); + OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Key to expect from grid: " + this.GridRecvKey); }