Start of Inventory service, currently only (partially) functional in standalone mode and using sqlite).

In standalone mode, if you have account authenticate turned on (setting in opensim.ini) then when you create a new account, a set of inventory is created for that account and stored in database (currently only a set of empty folders). Then during login the database is search for that set and sent to the client in the login response.
More functions will be added soon, like creating new folders (and a bit later items) from the client inventory window.
This commit is contained in:
MW
2007-08-14 13:54:46 +00:00
parent 7b2663a41e
commit a228b5984e
14 changed files with 663 additions and 30 deletions

View File

@@ -155,7 +155,7 @@ namespace OpenSim
}
// Load all script engines found
OpenSim.Region.Environment.Scenes.Scripting.ScriptEngineLoader ScriptEngineLoader = new OpenSim.Region.Environment.Scenes.Scripting.ScriptEngineLoader();
//OpenSim.Region.Environment.Scenes.Scripting.ScriptEngineLoader ScriptEngineLoader = new OpenSim.Region.Environment.Scenes.Scripting.ScriptEngineLoader();
for (int i = 0; i < configFiles.Length; i++)
{
@@ -184,10 +184,6 @@ namespace OpenSim
{
this.m_udpServers[i].ServerListener();
}
}
private static void CreateDefaultRegionInfoXml(string fileName)

View File

@@ -32,23 +32,32 @@ using OpenSim.Framework.Servers;
using OpenSim.Framework.Communications.Caches;
using OpenSim.Framework.Console;
using OpenSim.Framework.Utilities;
using OpenSim.Framework.Data;
namespace OpenSim.Region.Communications.Local
{
public class CommunicationsLocal : CommunicationsManager
{
public LocalBackEndServices InstanceServices = new LocalBackEndServices();
public LocalBackEndServices InstanceServices;
public LocalUserServices UserServices;
public LocalLoginService LoginServices;
public LocalInventoryService InvenServices;
public CommunicationsLocal(NetworkServersInfo serversInfo, BaseHttpServer httpServer, AssetCache assetCache, bool accountsAuthenticate, string welcomeMessage )
: base(serversInfo, httpServer, assetCache)
{
InvenServices = new LocalInventoryService();
InvenServices.AddPlugin("OpenSim.Framework.Data.SQLite.dll");
InventoryServer = InvenServices;
UserServices = new LocalUserServices(this, serversInfo);
UserServices.AddPlugin("OpenSim.Framework.Data.DB4o.dll");
UserServer = UserServices;
InstanceServices = new LocalBackEndServices();
GridServer = InstanceServices;
InterRegion = InstanceServices;
LoginServices = new LocalLoginService(UserServices, welcomeMessage, this, serversInfo, accountsAuthenticate);
httpServer.AddXmlRPCHandler("login_to_simulator", LoginServices.XmlRpcLoginMethod);
}
@@ -78,6 +87,12 @@ namespace OpenSim.Region.Communications.Local
tempMD5Passwd = Util.Md5Hash(Util.Md5Hash(tempMD5Passwd) + ":" + "");
this.UserServices.AddUserProfile(tempfirstname, templastname, tempMD5Passwd, regX, regY);
UserProfileData userProf = this.UserServer.GetUserProfile(tempfirstname, templastname);
if (userProf != null)
{
this.InvenServices.CreateNewUserInventory(userProf.UUID);
Console.WriteLine("created new inventory set for " + tempfirstname + " " + templastname);
}
break;
}
}

View File

@@ -0,0 +1,51 @@
using System;
using System.Collections.Generic;
using libsecondlife;
using OpenSim.Framework.Communications;
using OpenSim.Framework.Data;
using OpenSim.Framework.Types;
using OpenSim.Framework.UserManagement;
using OpenSim.Framework.Utilities;
using OpenSim.Framework.InventoryServiceBase;
using InventoryFolder = OpenSim.Framework.Communications.Caches.InventoryFolder;
namespace OpenSim.Region.Communications.Local
{
public class LocalInventoryService : InventoryServiceBase , IInventoryServices
{
public LocalInventoryService()
{
}
public void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack, InventoryItemInfo itemCallBack)
{
List<InventoryFolderBase> folders = this.RequestFirstLevelFolders(userID);
InventoryFolder rootFolder = null;
//need to make sure we send root folder first
foreach (InventoryFolderBase folder in folders)
{
if (folder.parentID == libsecondlife.LLUUID.Zero)
{
InventoryFolder newfolder = new InventoryFolder(folder);
rootFolder = newfolder;
folderCallBack(userID, newfolder);
}
}
if (rootFolder != null)
{
foreach (InventoryFolderBase folder in folders)
{
if (folder.folderID != rootFolder.folderID)
{
InventoryFolder newfolder = new InventoryFolder(folder);
folderCallBack(userID, newfolder);
}
}
}
}
}
}

View File

@@ -1,10 +1,13 @@
using System;
using System.Collections;
using System.Collections.Generic;
using libsecondlife;
using OpenSim.Framework.Communications;
using OpenSim.Framework.Data;
using OpenSim.Framework.Types;
using OpenSim.Framework.UserManagement;
using OpenSim.Framework.Utilities;
using OpenSim.Framework.Inventory;
namespace OpenSim.Region.Communications.Local
{
@@ -109,5 +112,51 @@ namespace OpenSim.Region.Communications.Local
}
}
protected override InventoryData CreateInventoryData(LLUUID userID)
{
List<InventoryFolderBase> folders = this.m_Parent.InvenServices.RequestFirstLevelFolders(userID);
if (folders.Count > 0)
{
LLUUID rootID = LLUUID.Zero;
ArrayList AgentInventoryArray = new ArrayList();
Hashtable TempHash;
foreach (InventoryFolderBase InvFolder in folders)
{
if (InvFolder.parentID == LLUUID.Zero)
{
rootID = InvFolder.folderID;
}
TempHash = new Hashtable();
TempHash["name"] = InvFolder.name;
TempHash["parent_id"] = InvFolder.parentID.ToStringHyphenated();
TempHash["version"] = (Int32)InvFolder.version;
TempHash["type_default"] = (Int32)InvFolder.type;
TempHash["folder_id"] = InvFolder.folderID.ToStringHyphenated();
AgentInventoryArray.Add(TempHash);
}
return new InventoryData(AgentInventoryArray, rootID);
}
else
{
AgentInventory userInventory = new AgentInventory();
userInventory.CreateRootFolder(userID, false);
ArrayList AgentInventoryArray = new ArrayList();
Hashtable TempHash;
foreach (OpenSim.Framework.Inventory.InventoryFolder InvFolder in userInventory.InventoryFolders.Values)
{
TempHash = new Hashtable();
TempHash["name"] = InvFolder.FolderName;
TempHash["parent_id"] = InvFolder.ParentID.ToStringHyphenated();
TempHash["version"] = (Int32)InvFolder.Version;
TempHash["type_default"] = (Int32)InvFolder.DefaultType;
TempHash["folder_id"] = InvFolder.FolderID.ToStringHyphenated();
AgentInventoryArray.Add(TempHash);
}
return new InventoryData(AgentInventoryArray, userInventory.InventoryRoot.FolderID);
}
}
}
}

View File

@@ -1020,7 +1020,8 @@ namespace OpenSim.Region.Environment.Scenes
public void AddScriptEngine(OpenSim.Region.Environment.Scenes.Scripting.ScriptEngineInterface ScriptEngine)
{
ScriptEngines.Add(ScriptEngine);
ScriptEngine.InitializeEngine(this); }
ScriptEngine.InitializeEngine(this);
}
#endregion
public LLUUID ConvertLocalIDToFullID(uint localID)
@@ -1037,8 +1038,7 @@ namespace OpenSim.Region.Environment.Scenes
}
}
}
return null;
return LLUUID.Zero;
}
}
}

View File

@@ -467,7 +467,7 @@ namespace OpenSim.DataStore.MonoSqliteStorage
addPrim(prim, obj.UUID);
}
MainLog.Instance.Verbose("Attempting to do database update....");
// MainLog.Instance.Verbose("Attempting to do database update....");
primDa.Update(ds, "prims");
shapeDa.Update(ds, "primshapes");
// MainLog.Instance.Verbose("Dump of prims:", ds.GetXml());