Start of the OpenSim library , for now only contains a few textures.
parent
3641ef0fdd
commit
2b42ea0a42
|
@ -50,7 +50,7 @@ namespace OpenSim.Framework.Communications.Caches
|
|||
InventoryFolder subFold = new InventoryFolder();
|
||||
subFold.name = folderName;
|
||||
subFold.folderID = folderID;
|
||||
subFold.type = type;
|
||||
subFold.type = (short) type;
|
||||
subFold.parentID = this.folderID;
|
||||
subFold.agentID = this.agentID;
|
||||
this.SubFolders.Add(subFold.folderID, subFold);
|
||||
|
|
|
@ -0,0 +1,89 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using libsecondlife;
|
||||
using OpenSim.Framework.Data;
|
||||
|
||||
namespace OpenSim.Framework.Communications.Caches
|
||||
{
|
||||
public class LibraryRootFolder : InventoryFolder
|
||||
{
|
||||
private LLUUID libOwner = new LLUUID("11111111-1111-0000-0000-000100bba000");
|
||||
|
||||
public LibraryRootFolder()
|
||||
{
|
||||
this.agentID = libOwner;
|
||||
this.folderID = new LLUUID("00000112-000f-0000-0000-000100bba000");
|
||||
this.name = "OpenSim Library";
|
||||
this.parentID = LLUUID.Zero;
|
||||
this.type = (short)-1;
|
||||
this.version = (ushort) 1;
|
||||
|
||||
InventoryItemBase item = new InventoryItemBase();
|
||||
item.avatarID = libOwner;
|
||||
item.creatorsID = libOwner;
|
||||
item.inventoryID = LLUUID.Random();
|
||||
item.assetID = new LLUUID("00000000-0000-0000-9999-000000000002");
|
||||
item.inventoryDescription = "Plywood texture";
|
||||
item.inventoryName = "Plywood";
|
||||
item.type =0;
|
||||
item.parentFolderID = this.folderID;
|
||||
item.inventoryCurrentPermissions = 2147483647;
|
||||
item.inventoryNextPermissions = 2147483647;
|
||||
this.Items.Add(item.inventoryID, item);
|
||||
|
||||
item = new InventoryItemBase();
|
||||
item.avatarID = libOwner;
|
||||
item.creatorsID = libOwner;
|
||||
item.inventoryID = LLUUID.Random();
|
||||
item.assetID = new LLUUID("00000000-0000-0000-9999-000000000003");
|
||||
item.inventoryDescription = "Rocks texture";
|
||||
item.inventoryName = "Rocks";
|
||||
item.type = 0;
|
||||
item.parentFolderID = this.folderID;
|
||||
item.inventoryCurrentPermissions = 2147483647;
|
||||
item.inventoryNextPermissions = 2147483647;
|
||||
this.Items.Add(item.inventoryID, item);
|
||||
|
||||
item = new InventoryItemBase();
|
||||
item.avatarID = libOwner;
|
||||
item.creatorsID = libOwner;
|
||||
item.inventoryID = LLUUID.Random();
|
||||
item.assetID = new LLUUID("00000000-0000-0000-9999-000000000001");
|
||||
item.inventoryDescription = "Bricks texture";
|
||||
item.inventoryName = "Bricks";
|
||||
item.type = 0;
|
||||
item.parentFolderID = this.folderID;
|
||||
item.inventoryCurrentPermissions = 2147483647;
|
||||
item.inventoryNextPermissions = 2147483647;
|
||||
this.Items.Add(item.inventoryID, item);
|
||||
|
||||
item = new InventoryItemBase();
|
||||
item.avatarID = libOwner;
|
||||
item.creatorsID = libOwner;
|
||||
item.inventoryID = LLUUID.Random();
|
||||
item.assetID = new LLUUID("00000000-0000-0000-9999-000000000004");
|
||||
item.inventoryDescription = "Granite texture";
|
||||
item.inventoryName = "Granite";
|
||||
item.type = 0;
|
||||
item.parentFolderID = this.folderID;
|
||||
item.inventoryCurrentPermissions = 2147483647;
|
||||
item.inventoryNextPermissions = 2147483647;
|
||||
this.Items.Add(item.inventoryID, item);
|
||||
|
||||
item = new InventoryItemBase();
|
||||
item.avatarID = libOwner;
|
||||
item.creatorsID = libOwner;
|
||||
item.inventoryID = LLUUID.Random();
|
||||
item.assetID = new LLUUID("00000000-0000-0000-9999-000000000005");
|
||||
item.inventoryDescription = "Hardwood texture";
|
||||
item.inventoryName = "Hardwood";
|
||||
item.type = 0;
|
||||
item.parentFolderID = this.folderID;
|
||||
item.inventoryCurrentPermissions = 2147483647;
|
||||
item.inventoryNextPermissions = 2147483647;
|
||||
this.Items.Add(item.inventoryID, item);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -38,19 +38,25 @@ using OpenSim.Framework.Data;
|
|||
|
||||
namespace OpenSim.Framework.Communications.Caches
|
||||
{
|
||||
|
||||
public class UserProfileCache
|
||||
{
|
||||
// Fields
|
||||
private CommunicationsManager m_parent;
|
||||
public Dictionary<LLUUID, CachedUserInfo> UserProfiles = new Dictionary<LLUUID, CachedUserInfo>();
|
||||
|
||||
public LibraryRootFolder libraryRoot = new LibraryRootFolder();
|
||||
|
||||
// Methods
|
||||
public UserProfileCache(CommunicationsManager parent)
|
||||
{
|
||||
this.m_parent = parent;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A new user has moved into a region in this instance
|
||||
/// so get info from servers
|
||||
/// </summary>
|
||||
/// <param name="userID"></param>
|
||||
public void AddNewUser(LLUUID userID)
|
||||
{
|
||||
if (!this.UserProfiles.ContainsKey(userID))
|
||||
|
@ -69,6 +75,12 @@ namespace OpenSim.Framework.Communications.Caches
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A new user has moved into a region in this instance
|
||||
/// so get info from servers
|
||||
/// </summary>
|
||||
/// <param name="firstName"></param>
|
||||
/// <param name="lastName"></param>
|
||||
public void AddNewUser(string firstName, string lastName)
|
||||
{
|
||||
}
|
||||
|
@ -104,7 +116,11 @@ namespace OpenSim.Framework.Communications.Caches
|
|||
|
||||
public void HandleFecthInventoryDescendents(IClientAPI remoteClient, LLUUID folderID, LLUUID ownerID, bool fetchFolders, bool fetchItems, int sortOrder)
|
||||
{
|
||||
if (this.UserProfiles.ContainsKey(remoteClient.AgentId))
|
||||
if (folderID == libraryRoot.folderID )
|
||||
{
|
||||
remoteClient.SendInventoryFolderDetails(libraryRoot.agentID, libraryRoot.folderID, libraryRoot.RequestListOfItems());
|
||||
}
|
||||
else if (this.UserProfiles.ContainsKey(remoteClient.AgentId))
|
||||
{
|
||||
CachedUserInfo info = this.UserProfiles[remoteClient.AgentId];
|
||||
if (info.RootFolder.folderID == folderID)
|
||||
|
@ -127,7 +143,11 @@ namespace OpenSim.Framework.Communications.Caches
|
|||
|
||||
public void HandleFetchInventory(IClientAPI remoteClient, LLUUID itemID, LLUUID ownerID)
|
||||
{
|
||||
if (this.UserProfiles.ContainsKey(remoteClient.AgentId))
|
||||
if (ownerID == libraryRoot.agentID)
|
||||
{
|
||||
//Console.WriteLine("request info for library item");
|
||||
}
|
||||
else if (this.UserProfiles.ContainsKey(remoteClient.AgentId))
|
||||
{
|
||||
InventoryItemBase item = this.UserProfiles[remoteClient.AgentId].RootFolder.HasItem(itemID);
|
||||
if (item != null)
|
||||
|
@ -137,8 +157,16 @@ namespace OpenSim.Framework.Communications.Caches
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Request Iventory Info from Inventory server
|
||||
/// </summary>
|
||||
/// <param name="userID"></param>
|
||||
private void RequestInventoryForUser(LLUUID userID, CachedUserInfo userInfo)
|
||||
{
|
||||
// this.m_parent.InventoryServer.RequestInventoryForUser(userID, userInfo.FolderReceive, userInfo.ItemReceive);
|
||||
|
||||
//for now we manually create the root folder,
|
||||
// but should be requesting all inventory from inventory server.
|
||||
InventoryFolder folderInfo = new InventoryFolder();
|
||||
folderInfo.agentID = userID;
|
||||
folderInfo.folderID = userInfo.UserProfile.rootInventoryFolderID;
|
||||
|
@ -149,19 +177,37 @@ namespace OpenSim.Framework.Communications.Caches
|
|||
userInfo.FolderReceive(userID, folderInfo);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Request the user profile from User server
|
||||
/// </summary>
|
||||
/// <param name="userID"></param>
|
||||
private UserProfileData RequestUserProfileForUser(LLUUID userID)
|
||||
{
|
||||
return this.m_parent.UserServer.GetUserProfile(userID);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update Inventory data to Inventory server
|
||||
/// </summary>
|
||||
/// <param name="userID"></param>
|
||||
private void UpdateInventoryToServer(LLUUID userID)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Make sure UserProfile is updated on user server
|
||||
/// </summary>
|
||||
/// <param name="userID"></param>
|
||||
private void UpdateUserProfileToServer(LLUUID userID)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A user has left this instance
|
||||
/// so make sure servers have been updated
|
||||
/// Then remove cached info
|
||||
/// </summary>
|
||||
/// <param name="userID"></param>
|
||||
public void UserLogOut(LLUUID userID)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ namespace OpenSim.Framework.Communications
|
|||
public IGridServices GridServer;
|
||||
public IInventoryServices InventoryServer;
|
||||
public IInterRegionCommunications InterRegion;
|
||||
public UserProfileCache UserProfilesCache;
|
||||
public UserProfileCache UserProfiles;
|
||||
public AssetCache AssetCache;
|
||||
|
||||
public NetworkServersInfo ServersInfo;
|
||||
|
@ -52,11 +52,17 @@ namespace OpenSim.Framework.Communications
|
|||
{
|
||||
ServersInfo = serversInfo;
|
||||
this.AssetCache = assetCache;
|
||||
UserProfilesCache = new UserProfileCache(this);
|
||||
UserProfiles = new UserProfileCache(this);
|
||||
}
|
||||
|
||||
#region Packet Handlers
|
||||
public void HandleUUIDNameRequest(LLUUID uuid, IClientAPI remote_client)
|
||||
{
|
||||
if (uuid == UserProfiles.libraryRoot.agentID)
|
||||
{
|
||||
remote_client.SendNameReply(uuid , "Mr" , "OpenSim");
|
||||
}
|
||||
else
|
||||
{
|
||||
UserProfileData profileData = this.UserServer.GetUserProfile(uuid);
|
||||
if (profileData != null)
|
||||
|
@ -68,6 +74,7 @@ namespace OpenSim.Framework.Communications
|
|||
remote_client.SendNameReply(profileId, firstname, lastname);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
|
|
@ -101,7 +101,7 @@ namespace OpenSim.Framework.Data
|
|||
/// <summary>
|
||||
/// Tyep of Items normally stored in this folder
|
||||
/// </summary>
|
||||
public ushort type;
|
||||
public short type;
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
|
|
|
@ -50,7 +50,7 @@ namespace OpenSim.Framework.InventoryServiceBase
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// Returns the root folder plus any folders in root (so down one level in the Inventory folders tree)
|
||||
/// </summary>
|
||||
/// <param name="userID"></param>
|
||||
/// <returns></returns>
|
||||
|
|
|
@ -27,6 +27,8 @@ namespace OpenSim.Framework.UserManagement
|
|||
private ArrayList inventoryRoot;
|
||||
private ArrayList initialOutfit;
|
||||
private ArrayList agentInventory;
|
||||
private ArrayList inventoryLibraryOwner;
|
||||
private ArrayList inventoryLibrary;
|
||||
|
||||
private UserInfo userProfile;
|
||||
|
||||
|
@ -87,6 +89,8 @@ namespace OpenSim.Framework.UserManagement
|
|||
this.inventoryRoot = new ArrayList();
|
||||
this.initialOutfit = new ArrayList();
|
||||
this.agentInventory = new ArrayList();
|
||||
this.inventoryLibrary = new ArrayList();
|
||||
this.inventoryLibraryOwner = new ArrayList();
|
||||
|
||||
this.xmlRpcResponse = new XmlRpcResponse();
|
||||
this.defaultXmlRpcResponse = new XmlRpcResponse();
|
||||
|
@ -234,10 +238,10 @@ namespace OpenSim.Framework.UserManagement
|
|||
responseData["ui-config"] = this.uiConfig;
|
||||
|
||||
responseData["inventory-skeleton"] = this.agentInventory;
|
||||
responseData["inventory-skel-lib"] = new ArrayList(); // todo
|
||||
responseData["inventory-skel-lib"] = this.inventoryLibrary;
|
||||
responseData["inventory-root"] = this.inventoryRoot;
|
||||
responseData["gestures"] = new ArrayList(); // todo
|
||||
responseData["inventory-lib-owner"] = new ArrayList(); // todo
|
||||
responseData["inventory-lib-owner"] = this.inventoryLibraryOwner;
|
||||
responseData["initial-outfit"] = this.initialOutfit;
|
||||
responseData["start_location"] = this.startLocation;
|
||||
responseData["seed_capability"] = this.seedCapability;
|
||||
|
@ -600,6 +604,30 @@ namespace OpenSim.Framework.UserManagement
|
|||
}
|
||||
}
|
||||
|
||||
public ArrayList InventoryLibrary
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.inventoryLibrary;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.inventoryLibrary = value;
|
||||
}
|
||||
}
|
||||
|
||||
public ArrayList InventoryLibraryOwner
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.inventoryLibraryOwner;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.inventoryLibraryOwner = value;
|
||||
}
|
||||
}
|
||||
|
||||
public string Home
|
||||
{
|
||||
get
|
||||
|
|
|
@ -346,6 +346,38 @@ namespace OpenSim.Framework.UserManagement
|
|||
return _config.DefaultStartupMsg;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
protected virtual ArrayList GetInventoryLibrary()
|
||||
{
|
||||
//return new ArrayList();
|
||||
Hashtable TempHash = new Hashtable();
|
||||
TempHash["name"] = "OpenSim Library";
|
||||
TempHash["parent_id"] = LLUUID.Zero.ToStringHyphenated();
|
||||
TempHash["version"] = "1";
|
||||
TempHash["type_default"] = "-1";
|
||||
TempHash["folder_id"] = "00000112-000f-0000-0000-000100bba000";
|
||||
ArrayList temp = new ArrayList();
|
||||
temp.Add(TempHash);
|
||||
return temp;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
protected virtual ArrayList GetLibraryOwner()
|
||||
{
|
||||
//for now create random inventory library owner
|
||||
Hashtable TempHash = new Hashtable();
|
||||
TempHash["agent_id"] = "11111111-1111-0000-0000-000100bba000";
|
||||
ArrayList inventoryLibOwner = new ArrayList();
|
||||
inventoryLibOwner.Add(TempHash);
|
||||
return inventoryLibOwner;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Customises the login response and fills in missing values.
|
||||
/// </summary>
|
||||
|
@ -446,6 +478,8 @@ namespace OpenSim.Framework.UserManagement
|
|||
logResponse.SecureSessionID = userProfile.currentAgent.secureSessionID.ToStringHyphenated();
|
||||
logResponse.InventoryRoot = InventoryRoot;
|
||||
logResponse.InventorySkeleton = AgentInventoryArray;
|
||||
logResponse.InventoryLibrary = this.GetInventoryLibrary();
|
||||
logResponse.InventoryLibraryOwner = this.GetLibraryOwner();
|
||||
logResponse.CircuitCode = (Int32)circode;
|
||||
//logResponse.RegionX = 0; //overwritten
|
||||
//logResponse.RegionY = 0; //overwritten
|
||||
|
|
|
@ -669,7 +669,7 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
/// <param name="nextOwnerMask"></param>
|
||||
public void CreateNewInventoryItem(IClientAPI remoteClient, LLUUID transActionID, LLUUID folderID, uint callbackID, string description, string name, sbyte invType, sbyte type, byte wearableType, uint nextOwnerMask)
|
||||
{
|
||||
CachedUserInfo userInfo = commsManager.UserProfilesCache.GetUserDetails(remoteClient.AgentId);
|
||||
CachedUserInfo userInfo = commsManager.UserProfiles.GetUserDetails(remoteClient.AgentId);
|
||||
if (userInfo != null)
|
||||
{
|
||||
AssetBase asset = new AssetBase();
|
||||
|
|
|
@ -546,7 +546,7 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
m_estateManager.sendRegionHandshake(client);
|
||||
CreateAndAddScenePresence(client);
|
||||
m_LandManager.sendParcelOverlay(client);
|
||||
// commsManager.UserProfilesCache.AddNewUser(client.AgentId);
|
||||
//commsManager.UserProfiles.AddNewUser(client.AgentId);
|
||||
}
|
||||
|
||||
protected virtual void SubscribeToClientEvents(IClientAPI client)
|
||||
|
@ -591,9 +591,9 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
client.OnEstateOwnerMessage += new EstateOwnerMessageRequest(m_estateManager.handleEstateOwnerMessage);
|
||||
|
||||
// client.OnCreateNewInventoryItem += CreateNewInventoryItem;
|
||||
// client.OnCreateNewInventoryFolder += commsManager.UserProfilesCache.HandleCreateInventoryFolder;
|
||||
// client.OnFetchInventoryDescendents += commsManager.UserProfilesCache.HandleFecthInventoryDescendents;
|
||||
// client.OnRequestTaskInventory += RequestTaskInventory;
|
||||
//client.OnCreateNewInventoryFolder += commsManager.UserProfiles.HandleCreateInventoryFolder;
|
||||
client.OnFetchInventoryDescendents += commsManager.UserProfiles.HandleFecthInventoryDescendents;
|
||||
client.OnRequestTaskInventory += RequestTaskInventory;
|
||||
}
|
||||
|
||||
protected ScenePresence CreateAndAddScenePresence(IClientAPI client)
|
||||
|
|
Loading…
Reference in New Issue