After hours of searching for a bug, it works - User accounts in sandbox mode, currently they are not persistent between restarts (ie restarting opensim.exe) but should be persistent between sessions (login/ logout).

Use the -account command line arg to enable them and then create new accounts through the web interface
tourmaline
MW 2007-03-28 18:10:52 +00:00
parent c3ae2a721b
commit 35fa85069e
15 changed files with 216 additions and 33 deletions

View File

@ -11,7 +11,7 @@ namespace OpenSim.Framework.Inventory
//Holds the local copy of Inventory info for a agent //Holds the local copy of Inventory info for a agent
public Dictionary<LLUUID, InventoryFolder> InventoryFolders; public Dictionary<LLUUID, InventoryFolder> InventoryFolders;
public Dictionary<LLUUID, InventoryItem> InventoryItems; public Dictionary<LLUUID, InventoryItem> InventoryItems;
public InventoryFolder InventoryRoot; public InventoryFolder InventoryRoot = new InventoryFolder();
public int LastCached; //maybe used by opensim app, time this was last stored/compared to user server public int LastCached; //maybe used by opensim app, time this was last stored/compared to user server
public LLUUID AgentID; public LLUUID AgentID;
public AvatarWearable[] Wearables; public AvatarWearable[] Wearables;
@ -36,8 +36,10 @@ namespace OpenSim.Framework.Inventory
InventoryRoot.ParentID = new LLUUID(); InventoryRoot.ParentID = new LLUUID();
InventoryRoot.Version = 1; InventoryRoot.Version = 1;
InventoryRoot.DefaultType = 8; InventoryRoot.DefaultType = 8;
InventoryRoot.OwnerID = this.AgentID;
InventoryRoot.FolderName = "My Inventory"; InventoryRoot.FolderName = "My Inventory";
InventoryFolders.Add(InventoryRoot.FolderID, InventoryRoot); InventoryFolders.Add(InventoryRoot.FolderID, InventoryRoot);
} }
public bool CreateNewFolder(LLUUID folderID, ushort type) public bool CreateNewFolder(LLUUID folderID, ushort type)
@ -47,10 +49,61 @@ namespace OpenSim.Framework.Inventory
Folder.OwnerID = this.AgentID; Folder.OwnerID = this.AgentID;
Folder.DefaultType = type; Folder.DefaultType = type;
this.InventoryFolders.Add(Folder.FolderID, Folder); this.InventoryFolders.Add(Folder.FolderID, Folder);
return (true);
}
public void CreateRootFolder(LLUUID newAgentID, bool createTextures)
{
this.AgentID = newAgentID;
/* 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);*/
InventoryRoot.OwnerID = this.AgentID;
if (createTextures)
{
this.CreateNewFolder(LLUUID.Random(), 0, "Textures", InventoryRoot.FolderID);
}
}
public bool CreateNewFolder(LLUUID folderID, ushort type, string folderName)
{
InventoryFolder Folder = new InventoryFolder();
Folder.FolderID = folderID;
Folder.OwnerID = this.AgentID;
Folder.DefaultType = type;
Folder.FolderName = folderName;
this.InventoryFolders.Add(Folder.FolderID, Folder);
return (true); return (true);
} }
public bool CreateNewFolder(LLUUID folderID, ushort type, string folderName, LLUUID parent)
{
InventoryFolder Folder = new InventoryFolder();
Folder.FolderID = folderID;
Folder.OwnerID = this.AgentID;
Folder.DefaultType = type;
Folder.FolderName = folderName;
Folder.ParentID = parent;
this.InventoryFolders.Add(Folder.FolderID, Folder);
return (true);
}
public bool HasFolder(LLUUID folderID)
{
if (this.InventoryFolders.ContainsKey(folderID))
{
return true;
}
return false;
}
public bool UpdateItem(LLUUID itemID, AssetBase asset) public bool UpdateItem(LLUUID itemID, AssetBase asset)
{ {
if(this.InventoryItems.ContainsKey(itemID)) if(this.InventoryItems.ContainsKey(itemID))
@ -96,7 +149,7 @@ namespace OpenSim.Framework.Inventory
//public List<InventoryFolder> Subfolders; //public List<InventoryFolder> Subfolders;
public LLUUID FolderID; public LLUUID FolderID;
public LLUUID OwnerID; public LLUUID OwnerID;
public LLUUID ParentID; public LLUUID ParentID = LLUUID.Zero;
public string FolderName; public string FolderName;
public ushort DefaultType; public ushort DefaultType;
public ushort Version; public ushort Version;

View File

@ -10,5 +10,6 @@ namespace OpenSim.Framework.Interfaces
{ {
AgentInventory RequestAgentsInventory(LLUUID agentID); AgentInventory RequestAgentsInventory(LLUUID agentID);
void SetServerInfo(string ServerUrl, string SendKey, string RecvKey); void SetServerInfo(string ServerUrl, string SendKey, string RecvKey);
bool UpdateAgentsInventory(LLUUID agentID, AgentInventory inventory);
} }
} }

View File

@ -32,6 +32,7 @@ namespace OpenSim.Framework.User
Circuits = new Dictionary<LLUUID, uint>(); Circuits = new Dictionary<LLUUID, uint>();
Inventory = new AgentInventory(); Inventory = new AgentInventory();
homeregionhandle = Helpers.UIntsToLong((997 * 256), (996 * 256)); ; homeregionhandle = Helpers.UIntsToLong((997 * 256), (996 * 256)); ;
} }
public void InitSessionData() public void InitSessionData()

View File

@ -68,6 +68,7 @@ namespace OpenSim.Framework.User
UserProfile TheUser = GetProfileByName(firstname, lastname); UserProfile TheUser = GetProfileByName(firstname, lastname);
/*
if (!((TheUser.CurrentSessionID == null) && (TheUser.CurrentSecureSessionID == null))) if (!((TheUser.CurrentSessionID == null) && (TheUser.CurrentSecureSessionID == null)))
{ {
XmlRpcResponse PresenceErrorResp = new XmlRpcResponse(); XmlRpcResponse PresenceErrorResp = new XmlRpcResponse();
@ -78,7 +79,7 @@ namespace OpenSim.Framework.User
PresenceErrorResp.Value = PresenceErrorRespData; PresenceErrorResp.Value = PresenceErrorRespData;
return (Regex.Replace(XmlRpcResponseSerializer.Singleton.Serialize(PresenceErrorResp), " encoding=\"utf-16\"", "")); return (Regex.Replace(XmlRpcResponseSerializer.Singleton.Serialize(PresenceErrorResp), " encoding=\"utf-16\"", ""));
} }*/
try try
{ {
@ -116,6 +117,7 @@ namespace OpenSim.Framework.User
ArrayList ClassifiedCategories = new ArrayList(); ArrayList ClassifiedCategories = new ArrayList();
ClassifiedCategories.Add(ClassifiedCategoriesHash); ClassifiedCategories.Add(ClassifiedCategoriesHash);
Console.WriteLine("copying inventory data to response");
ArrayList AgentInventory = new ArrayList(); ArrayList AgentInventory = new ArrayList();
foreach (InventoryFolder InvFolder in TheUser.Inventory.InventoryFolders.Values) foreach (InventoryFolder InvFolder in TheUser.Inventory.InventoryFolders.Values)
{ {
@ -142,7 +144,7 @@ namespace OpenSim.Framework.User
uint circode = (uint)(Util.RandomClass.Next()); uint circode = (uint)(Util.RandomClass.Next());
//TheUser.AddSimCircuit(circode, SimInfo.UUID); //TheUser.AddSimCircuit(circode, SimInfo.UUID);
LoginGoodData["last_name"] = "\"" + TheUser.firstname + "\""; LoginGoodData["last_name"] = "\"" + TheUser.lastname + "\"";
LoginGoodData["ui-config"] = ui_config; LoginGoodData["ui-config"] = ui_config;
LoginGoodData["sim_ip"] = "127.0.0.1"; //SimInfo.sim_ip.ToString(); LoginGoodData["sim_ip"] = "127.0.0.1"; //SimInfo.sim_ip.ToString();
LoginGoodData["login-flags"] = LoginFlags; LoginGoodData["login-flags"] = LoginFlags;
@ -160,7 +162,7 @@ namespace OpenSim.Framework.User
LoginGoodData["start_location"] = "last"; LoginGoodData["start_location"] = "last";
LoginGoodData["home"] = "{'region_handle':[r" + (997 * 256).ToString() + ",r" + (996 * 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() + "]}"; LoginGoodData["home"] = "{'region_handle':[r" + (997 * 256).ToString() + ",r" + (996 * 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() + "]}";
LoginGoodData["message"] = DefaultStartupMsg; LoginGoodData["message"] = DefaultStartupMsg;
LoginGoodData["first_name"] = "\"" + firstname + "\""; LoginGoodData["first_name"] = "\"" + TheUser.firstname + "\"";
LoginGoodData["circuit_code"] = (Int32)circode; LoginGoodData["circuit_code"] = (Int32)circode;
LoginGoodData["sim_port"] = 9000; //(Int32)SimInfo.sim_port; LoginGoodData["sim_port"] = 9000; //(Int32)SimInfo.sim_port;
LoginGoodData["secure_session_id"] = TheUser.CurrentSecureSessionID.ToStringHyphenated(); LoginGoodData["secure_session_id"] = TheUser.CurrentSecureSessionID.ToStringHyphenated();
@ -196,8 +198,8 @@ namespace OpenSim.Framework.User
SimProfile SimInfo = new SimProfile(); SimProfile SimInfo = new SimProfile();
//get siminfo from grid server //get siminfo from grid server
SimInfo = SimInfo.LoadFromGrid(theUser.homeregionhandle, GridURL, GridSendKey, GridRecvKey); SimInfo = SimInfo.LoadFromGrid(theUser.homeregionhandle, GridURL, GridSendKey, GridRecvKey);
uint circode = (uint)response["circuit_code"]; Int32 circode = (Int32)response["circuit_code"];
theUser.AddSimCircuit(circode, SimInfo.UUID); 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["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.ToString();
response["sim_port"] = (Int32)SimInfo.sim_port; response["sim_port"] = (Int32)SimInfo.sim_port;

View File

@ -41,19 +41,23 @@ namespace OpenSim.Framework.User
public virtual bool AuthenticateUser(string firstname, string lastname, string passwd) public virtual bool AuthenticateUser(string firstname, string lastname, string passwd)
{ {
UserProfile TheUser = GetProfileByName(firstname, lastname); UserProfile TheUser = GetProfileByName(firstname, lastname);
passwd = passwd.Remove(0, 3); //remove $1$
if (TheUser != null) if (TheUser != null)
{ {
if (TheUser.MD5passwd == passwd) if (TheUser.MD5passwd == passwd)
{ {
Console.WriteLine("UserProfile - authorised ");
return true; return true;
} }
else else
{ {
Console.WriteLine("UserProfile - not authorised, password not match "+ TheUser.MD5passwd +" and "+ passwd);
return false; return false;
} }
} }
else else
{ {
Console.WriteLine("UserProfile - not authorised , unkown: "+ firstname +" , " + lastname);
return false; return false;
} }
@ -66,12 +70,14 @@ namespace OpenSim.Framework.User
public virtual UserProfile CreateNewProfile(string firstname, string lastname, string MD5passwd) public virtual UserProfile CreateNewProfile(string firstname, string lastname, string MD5passwd)
{ {
Console.WriteLine("creating new profile for : " + firstname + " , " + lastname);
UserProfile newprofile = new UserProfile(); UserProfile newprofile = new UserProfile();
newprofile.homeregionhandle = Helpers.UIntsToLong((997 * 256), (996 * 256)); newprofile.homeregionhandle = Helpers.UIntsToLong((997 * 256), (996 * 256));
newprofile.firstname = firstname; newprofile.firstname = firstname;
newprofile.lastname = lastname; newprofile.lastname = lastname;
newprofile.MD5passwd = MD5passwd; newprofile.MD5passwd = MD5passwd;
newprofile.UUID = LLUUID.Random(); newprofile.UUID = LLUUID.Random();
newprofile.Inventory.CreateRootFolder(newprofile.UUID, true);
this.UserProfiles.Add(newprofile.UUID, newprofile); this.UserProfiles.Add(newprofile.UUID, newprofile);
return newprofile; return newprofile;
} }

View File

@ -201,6 +201,7 @@ namespace OpenSim
{ {
//already complete so we can add it to the inventory //already complete so we can add it to the inventory
m_assetCache.AddAsset(trans.Asset); m_assetCache.AddAsset(trans.Asset);
Console.WriteLine("creating inventory item");
Console.WriteLine( "ITem created is " +m_inventoryCache.AddNewInventoryItem(this.ourClient, packet.InventoryBlock.FolderID, trans.Asset).ToStringHyphenated()); Console.WriteLine( "ITem created is " +m_inventoryCache.AddNewInventoryItem(this.ourClient, packet.InventoryBlock.FolderID, trans.Asset).ToStringHyphenated());
} }
else else

View File

@ -33,6 +33,7 @@ using libsecondlife.Packets;
//using OpenSim.GridServers; //using OpenSim.GridServers;
using OpenSim.Framework.Inventory; using OpenSim.Framework.Inventory;
using OpenSim.Framework.Assets; using OpenSim.Framework.Assets;
using OpenSim.Framework.Interfaces;
namespace OpenSim.Assets namespace OpenSim.Assets
{ {
@ -53,9 +54,23 @@ namespace OpenSim.Assets
} }
public void AddNewAgentsInventory(AgentInventory agentInventory) public void AddNewAgentsInventory(AgentInventory agentInventory)
{
if (!this._agentsInventory.ContainsKey(agentInventory.AgentID))
{ {
this._agentsInventory.Add(agentInventory.AgentID, agentInventory); this._agentsInventory.Add(agentInventory.AgentID, agentInventory);
} }
}
public AgentInventory FetchAgentsInventory(LLUUID agentID, IUserServer userserver)
{
AgentInventory res = null;
if (!this._agentsInventory.ContainsKey(agentID))
{
res = userserver.RequestAgentsInventory(agentID);
this._agentsInventory.Add(agentID,res);
}
return res;
}
public AgentInventory GetAgentsInventory(LLUUID agentID) public AgentInventory GetAgentsInventory(LLUUID agentID)
{ {
@ -67,13 +82,16 @@ namespace OpenSim.Assets
return null; return null;
} }
public void ClientLeaving(LLUUID clientID) public void ClientLeaving(LLUUID clientID, IUserServer userserver)
{ {
if (this._agentsInventory.ContainsKey(clientID)) if (this._agentsInventory.ContainsKey(clientID))
{ {
if (userserver != null)
{
userserver.UpdateAgentsInventory(clientID, this._agentsInventory[clientID]);
}
this._agentsInventory.Remove(clientID); this._agentsInventory.Remove(clientID);
} }
} }
public bool CreateNewInventoryFolder(SimClient remoteClient, LLUUID folderID) public bool CreateNewInventoryFolder(SimClient remoteClient, LLUUID folderID)
@ -171,6 +189,7 @@ namespace OpenSim.Assets
Descend.ItemData[i].Type = Item.Type; Descend.ItemData[i].Type = Item.Type;
Descend.ItemData[i].CRC = libsecondlife.Helpers.InventoryCRC(1000, 0, Descend.ItemData[i].InvType, Descend.ItemData[i].Type, Descend.ItemData[i].AssetID, Descend.ItemData[i].GroupID, 100, Descend.ItemData[i].OwnerID, Descend.ItemData[i].CreatorID, Descend.ItemData[i].ItemID, Descend.ItemData[i].FolderID, FULL_MASK_PERMISSIONS, 1, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS); Descend.ItemData[i].CRC = libsecondlife.Helpers.InventoryCRC(1000, 0, Descend.ItemData[i].InvType, Descend.ItemData[i].Type, Descend.ItemData[i].AssetID, Descend.ItemData[i].GroupID, 100, Descend.ItemData[i].OwnerID, Descend.ItemData[i].CreatorID, Descend.ItemData[i].ItemID, Descend.ItemData[i].FolderID, FULL_MASK_PERMISSIONS, 1, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS);
} }
userInfo.OutPacket(Descend); userInfo.OutPacket(Descend);
} }

View File

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Text; using System.Text;
using System.IO; using System.IO;
using OpenSim.world; using OpenSim.world;
using OpenSim.UserServer;
namespace OpenSim.CAPS namespace OpenSim.CAPS
{ {
@ -13,9 +14,11 @@ namespace OpenSim.CAPS
private string LoginForm; private string LoginForm;
private string passWord = "Admin"; private string passWord = "Admin";
private World m_world; private World m_world;
private LoginServer _userServer;
public AdminWebFront(string password, World world) public AdminWebFront(string password, World world, LoginServer userserver)
{ {
_userServer = userserver;
m_world = world; m_world = world;
passWord = password; passWord = password;
LoadAdminPage(); LoadAdminPage();
@ -63,8 +66,12 @@ namespace OpenSim.CAPS
case "/Admin/NewAccount": case "/Admin/NewAccount":
if (requestMethod == "POST") if (requestMethod == "POST")
{ {
string[] comp = new string[10]; string firstName = "";
string[] passw = new string[3]; string secondName = "";
string userPasswd = "";
string[] comp;
string[] passw;
string[] line;
string delimStr = "&"; string delimStr = "&";
char[] delimiter = delimStr.ToCharArray(); char[] delimiter = delimStr.ToCharArray();
string delimStr2 = "="; string delimStr2 = "=";
@ -75,6 +82,26 @@ namespace OpenSim.CAPS
passw = comp[3].Split(delimiter2); passw = comp[3].Split(delimiter2);
if (passw[1] == passWord) if (passw[1] == passWord)
{ {
line = comp[0].Split(delimiter2); //split firstname
if (line.Length > 1)
{
firstName = line[1];
}
line = comp[1].Split(delimiter2); //split secondname
if (line.Length > 1)
{
secondName = line[1];
}
line = comp[2].Split(delimiter2); //split user password
if (line.Length > 1)
{
userPasswd = line[1];
}
if (this._userServer != null)
{
this._userServer.CreateUserAccount(firstName, secondName, userPasswd);
}
responseString = "<p> New Account created </p>"; responseString = "<p> New Account created </p>";
} }
else else

View File

@ -11,6 +11,7 @@ namespace OpenSim
{ {
public IAssetServer AssetServer; public IAssetServer AssetServer;
public IGridServer GridServer; public IGridServer GridServer;
public IUserServer UserServer;
public string AssetDll = ""; public string AssetDll = "";
public string GridDll = ""; public string GridDll = "";

View File

@ -16,7 +16,6 @@
<include name="Grid.cs" /> <include name="Grid.cs" />
<include name="OpenSimMain.cs" /> <include name="OpenSimMain.cs" />
<include name="OpenSimNetworkHandler.cs" /> <include name="OpenSimNetworkHandler.cs" />
<include name="OpenSimRoot.cs" />
<include name="QueItem.cs" /> <include name="QueItem.cs" />
<include name="SimClient.cs" /> <include name="SimClient.cs" />
<include name="SimConsole.cs" /> <include name="SimConsole.cs" />

View File

@ -75,6 +75,7 @@ namespace OpenSim
public string m_physicsEngine; public string m_physicsEngine;
public bool m_sandbox = false; public bool m_sandbox = false;
public bool m_loginserver; public bool m_loginserver;
public bool user_accounts = false;
protected ConsoleBase m_console; protected ConsoleBase m_console;
@ -145,12 +146,22 @@ namespace OpenSim
m_console.WriteLine("Main.cs:Startup() - Starting CAPS HTTP server"); m_console.WriteLine("Main.cs:Startup() - Starting CAPS HTTP server");
HttpServer = new SimCAPSHTTPServer(GridServers.GridServer, Cfg.IPListenPort); HttpServer = new SimCAPSHTTPServer(GridServers.GridServer, Cfg.IPListenPort);
HttpServer.AddRestHandler("Admin", new AdminWebFront("Admin", LocalWorld));
if ( m_loginserver && m_sandbox) LoginServer loginServer = null;
if (m_loginserver && m_sandbox)
{ {
LoginServer loginServer = new LoginServer(GridServers.GridServer, Cfg.IPListenAddr, Cfg.IPListenPort); loginServer = new LoginServer(GridServers.GridServer, Cfg.IPListenAddr, Cfg.IPListenPort, this.user_accounts);
loginServer.Startup(); loginServer.Startup();
}
if((m_loginserver) && (m_sandbox) && (user_accounts))
{
this.GridServers.UserServer = loginServer;
HttpServer.AddRestHandler("Admin", new AdminWebFront("Admin", LocalWorld, loginServer));
}
else
{
HttpServer.AddRestHandler("Admin", new AdminWebFront("Admin", LocalWorld, null));
} }
MainServerListener(); MainServerListener();
@ -210,6 +221,11 @@ namespace OpenSim
UseCircuitCodePacket useCircuit = (UseCircuitCodePacket)packet; UseCircuitCodePacket useCircuit = (UseCircuitCodePacket)packet;
this.clientCircuits.Add(epSender, useCircuit.CircuitCode.Code); this.clientCircuits.Add(epSender, useCircuit.CircuitCode.Code);
SimClient newuser = new SimClient(epSender, useCircuit, LocalWorld, ClientThreads, AssetCache, GridServers.GridServer, this, InventoryCache, m_sandbox); SimClient newuser = new SimClient(epSender, useCircuit, LocalWorld, ClientThreads, AssetCache, GridServers.GridServer, this, InventoryCache, m_sandbox);
if ((this.GridServers.UserServer != null) && (user_accounts))
{
Console.WriteLine("setting userserver");
newuser.UserServer = this.GridServers.UserServer;
}
//OpenSimRoot.Instance.ClientThreads.Add(epSender, newuser); //OpenSimRoot.Instance.ClientThreads.Add(epSender, newuser);
ClientThreads.Add(useCircuit.CircuitCode.Code, newuser); ClientThreads.Add(useCircuit.CircuitCode.Code, newuser);
} }

View File

@ -75,10 +75,20 @@ namespace OpenSim
private Dictionary<uint, SimClient> m_clientThreads; private Dictionary<uint, SimClient> m_clientThreads;
private AssetCache m_assetCache; private AssetCache m_assetCache;
private IGridServer m_gridServer; private IGridServer m_gridServer;
private IUserServer m_userServer = null;
private OpenSimNetworkHandler m_application; private OpenSimNetworkHandler m_application;
private InventoryCache m_inventoryCache; private InventoryCache m_inventoryCache;
private bool m_sandboxMode; private bool m_sandboxMode;
public IUserServer UserServer
{
set
{
this.m_userServer = value;
}
}
private void ack_pack(Packet Pack) private void ack_pack(Packet Pack)
{ {
//libsecondlife.Packets.PacketAckPacket ack_it = new PacketAckPacket(); //libsecondlife.Packets.PacketAckPacket ack_it = new PacketAckPacket();
@ -241,6 +251,15 @@ namespace OpenSim
{ {
client.OutPacket(kill); client.OutPacket(kill);
} }
if (this.m_userServer != null)
{
this.m_inventoryCache.ClientLeaving(this.AgentID, this.m_userServer);
}
else
{
this.m_inventoryCache.ClientLeaving(this.AgentID, null);
}
m_gridServer.LogoutSession(this.SessionID, this.AgentID, this.CircuitCode); m_gridServer.LogoutSession(this.SessionID, this.AgentID, this.CircuitCode);
lock (m_world.Entities) lock (m_world.Entities)
{ {
@ -657,12 +676,16 @@ namespace OpenSim
// Create Inventory, currently only works for sandbox mode // Create Inventory, currently only works for sandbox mode
if (m_sandboxMode) if (m_sandboxMode)
{ {
AgentInventory inventory = null;
if (sessionInfo.LoginInfo.InventoryFolder != null) if (sessionInfo.LoginInfo.InventoryFolder != null)
{ {
this.CreateInventory(sessionInfo.LoginInfo.InventoryFolder); inventory = this.CreateInventory(sessionInfo.LoginInfo.InventoryFolder);
if (sessionInfo.LoginInfo.BaseFolder != null) if (sessionInfo.LoginInfo.BaseFolder != null)
{
if (!inventory.HasFolder(sessionInfo.LoginInfo.BaseFolder))
{ {
m_inventoryCache.CreateNewInventoryFolder(this, sessionInfo.LoginInfo.BaseFolder); m_inventoryCache.CreateNewInventoryFolder(this, sessionInfo.LoginInfo.BaseFolder);
}
this.newAssetFolder = sessionInfo.LoginInfo.BaseFolder; this.newAssetFolder = sessionInfo.LoginInfo.BaseFolder;
AssetBase[] inventorySet = m_assetCache.CreateNewInventorySet(this.AgentID); AssetBase[] inventorySet = m_assetCache.CreateNewInventorySet(this.AgentID);
if (inventorySet != null) if (inventorySet != null)
@ -683,12 +706,23 @@ namespace OpenSim
} }
} }
private void CreateInventory(LLUUID baseFolder) private AgentInventory CreateInventory(LLUUID baseFolder)
{ {
AgentInventory inventory = new AgentInventory(); AgentInventory inventory = null;
if (this.m_userServer != null)
{
// a user server is set so request the inventory from it
inventory = m_inventoryCache.FetchAgentsInventory(this.AgentID, m_userServer);
}
else
{
inventory = new AgentInventory();
inventory.AgentID = this.AgentID; inventory.AgentID = this.AgentID;
inventory.CreateRootFolder(this.AgentID, false);
m_inventoryCache.AddNewAgentsInventory(inventory); m_inventoryCache.AddNewAgentsInventory(inventory);
m_inventoryCache.CreateNewInventoryFolder(this, baseFolder); m_inventoryCache.CreateNewInventoryFolder(this, baseFolder);
} }
return inventory;
}
} }
} }

View File

@ -30,8 +30,8 @@ namespace OpenSim.UserServer
public override void CustomiseResponse(ref System.Collections.Hashtable response, UserProfile theUser) public override void CustomiseResponse(ref System.Collections.Hashtable response, UserProfile theUser)
{ {
uint circode = (uint)response["circuit_code"]; Int32 circode = (Int32)response["circuit_code"];
theUser.AddSimCircuit(circode, LLUUID.Random()); theUser.AddSimCircuit((uint)circode, LLUUID.Random());
response["home"] = "{'region_handle':[r" + (997 * 256).ToString() + ",r" + (996 * 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["home"] = "{'region_handle':[r" + (997 * 256).ToString() + ",r" + (996 * 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_port"] = m_port; response["sim_port"] = m_port;
response["sim_ip"] = m_ipAddr; response["sim_ip"] = m_ipAddr;
@ -40,18 +40,18 @@ namespace OpenSim.UserServer
string first; string first;
string last; string last;
if (response.Contains("first")) if (response.Contains("first_name"))
{ {
first = (string)response["first"]; first = (string)response["first_name"];
} }
else else
{ {
first = "test"; first = "test";
} }
if (response.Contains("last")) if (response.Contains("last_name"))
{ {
last = (string)response["last"]; last = (string)response["last_name"];
} }
else else
{ {
@ -67,12 +67,14 @@ namespace OpenSim.UserServer
_login.Last = last; _login.Last = last;
_login.Agent = new LLUUID((string)response["agent_id"]) ; _login.Agent = new LLUUID((string)response["agent_id"]) ;
_login.Session = new LLUUID((string)response["session_id"]); _login.Session = new LLUUID((string)response["session_id"]);
_login.SecureSession = new LLUUID((string)response["secure_session_id"]);
_login.BaseFolder = null; _login.BaseFolder = null;
_login.InventoryFolder = new LLUUID((string)Inventory1["folder_id"]); _login.InventoryFolder = new LLUUID((string)Inventory1["folder_id"]);
//working on local computer if so lets add to the gridserver's list of sessions? //working on local computer if so lets add to the gridserver's list of sessions?
if (m_gridServer.GetName() == "Local") if (m_gridServer.GetName() == "Local")
{ {
Console.WriteLine("adding login data to gridserver");
((LocalGridBase)this.m_gridServer).AddNewSession(_login); ((LocalGridBase)this.m_gridServer).AddNewSession(_login);
} }
} }

View File

@ -66,11 +66,12 @@ namespace OpenSim.UserServer
private int m_simPort; private int m_simPort;
private string m_simAddr; private string m_simAddr;
public LoginServer(IGridServer gridServer, string simAddr, int simPort) public LoginServer(IGridServer gridServer, string simAddr, int simPort , bool useAccounts)
{ {
m_gridServer = gridServer; m_gridServer = gridServer;
m_simPort = simPort; m_simPort = simPort;
m_simAddr = simAddr; m_simAddr = simAddr;
this.userAccounts = useAccounts;
} }
// InitializeLogin: initialize the login // InitializeLogin: initialize the login
@ -395,6 +396,15 @@ namespace OpenSim.UserServer
return Regex.Replace(BitConverter.ToString(encodedBytes), "-", "").ToLower(); return Regex.Replace(BitConverter.ToString(encodedBytes), "-", "").ToLower();
} }
public bool CreateUserAccount(string firstName, string lastName, string password)
{
Console.WriteLine("creating new user account");
string mdPassword = EncodePassword(password);
Console.WriteLine("with password: " + mdPassword);
this.userManager.CreateNewProfile(firstName, lastName, mdPassword);
return true;
}
//IUserServer implementation //IUserServer implementation
public AgentInventory RequestAgentsInventory(LLUUID agentID) public AgentInventory RequestAgentsInventory(LLUUID agentID)
{ {
@ -407,6 +417,11 @@ namespace OpenSim.UserServer
return aInventory; return aInventory;
} }
public bool UpdateAgentsInventory(LLUUID agentID, AgentInventory inventory)
{
return true;
}
public void SetServerInfo(string ServerUrl, string SendKey, string RecvKey) public void SetServerInfo(string ServerUrl, string SendKey, string RecvKey)
{ {

View File

@ -18,6 +18,7 @@ namespace OpenSim
bool startLoginServer = false; bool startLoginServer = false;
string physicsEngine = "basicphysics"; string physicsEngine = "basicphysics";
bool allowFlying = false; bool allowFlying = false;
bool userAccounts = false;
for (int i = 0; i < args.Length; i++) for (int i = 0; i < args.Length; i++)
{ {
@ -30,6 +31,10 @@ namespace OpenSim
{ {
startLoginServer = true; startLoginServer = true;
} }
if (args[i] == "-accounts")
{
userAccounts = true;
}
if (args[i] == "-realphysx") if (args[i] == "-realphysx")
{ {
physicsEngine = "RealPhysX"; physicsEngine = "RealPhysX";
@ -44,6 +49,7 @@ namespace OpenSim
OpenSimMain sim = new OpenSimMain( sandBoxMode, startLoginServer, physicsEngine ); OpenSimMain sim = new OpenSimMain( sandBoxMode, startLoginServer, physicsEngine );
// OpenSimRoot.Instance.Application = sim; // OpenSimRoot.Instance.Application = sim;
sim.m_sandbox = sandBoxMode; sim.m_sandbox = sandBoxMode;
sim.user_accounts = userAccounts;
OpenSim.world.Avatar.PhysicsEngineFlying = allowFlying; OpenSim.world.Avatar.PhysicsEngineFlying = allowFlying;
sim.StartUp(); sim.StartUp();