Some work on Inventory (not yet finished or enabled)
parent
de104536c1
commit
b2c6f316e1
|
@ -36,7 +36,7 @@ namespace OpenSim.Framework.Communications.Caches
|
||||||
return returnFolder;
|
return returnFolder;
|
||||||
}
|
}
|
||||||
|
|
||||||
public InventoryFolder CreateNewSubFolder(LLUUID folderID, string folderName, ushort type)
|
public InventoryFolder CreateNewSubFolder(LLUUID folderID, string folderName, ushort type )
|
||||||
{
|
{
|
||||||
InventoryFolder subFold = new InventoryFolder();
|
InventoryFolder subFold = new InventoryFolder();
|
||||||
subFold.name = folderName;
|
subFold.name = folderName;
|
||||||
|
@ -47,5 +47,15 @@ namespace OpenSim.Framework.Communications.Caches
|
||||||
this.SubFolders.Add(subFold.folderID, subFold);
|
this.SubFolders.Add(subFold.folderID, subFold);
|
||||||
return subFold;
|
return subFold;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<InventoryItemBase> RequestListOfItems()
|
||||||
|
{
|
||||||
|
List<InventoryItemBase> itemList = new List<InventoryItemBase>();
|
||||||
|
foreach (InventoryItemBase item in this.Items.Values)
|
||||||
|
{
|
||||||
|
itemList.Add(item);
|
||||||
|
}
|
||||||
|
return itemList;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using libsecondlife;
|
using libsecondlife;
|
||||||
|
using OpenSim.Framework.Interfaces;
|
||||||
using OpenSim.Framework.Data;
|
using OpenSim.Framework.Data;
|
||||||
using OpenSim.Framework.Communications;
|
using OpenSim.Framework.Communications;
|
||||||
|
|
||||||
|
@ -29,14 +30,17 @@ namespace OpenSim.Framework.Communications.Caches
|
||||||
{
|
{
|
||||||
CachedUserInfo userInfo = new CachedUserInfo();
|
CachedUserInfo userInfo = new CachedUserInfo();
|
||||||
userInfo.UserProfile = this.RequestUserProfileForUser(userID);
|
userInfo.UserProfile = this.RequestUserProfileForUser(userID);
|
||||||
this.m_parent.InventoryServer.RequestInventoryForUser(userID, userInfo.FolderReceive, userInfo.ItemReceive);
|
|
||||||
if (userInfo.UserProfile != null)
|
if (userInfo.UserProfile != null)
|
||||||
{
|
{
|
||||||
|
this.RequestInventoryForUser(userID, userInfo);
|
||||||
this.UserProfiles.Add(userID, userInfo);
|
this.UserProfiles.Add(userID, userInfo);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//no profile for this user, what do we do now?
|
//no profile for this user, what do we do now?
|
||||||
|
Console.WriteLine("UserProfileCache.cs: user profile for user not found");
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -68,6 +72,52 @@ namespace OpenSim.Framework.Communications.Caches
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void HandleCreateInventoryFolder(IClientAPI remoteClient, LLUUID folderID, ushort folderType, string folderName, LLUUID parentID)
|
||||||
|
{
|
||||||
|
if (this.UserProfiles.ContainsKey(remoteClient.AgentId))
|
||||||
|
{
|
||||||
|
CachedUserInfo userInfo = this.UserProfiles[remoteClient.AgentId];
|
||||||
|
if (userInfo.RootFolder.folderID == parentID)
|
||||||
|
{
|
||||||
|
userInfo.RootFolder.CreateNewSubFolder(folderID, folderName, folderType);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
InventoryFolder parentFolder = userInfo.RootFolder.HasSubFolder(parentID);
|
||||||
|
if (parentFolder != null)
|
||||||
|
{
|
||||||
|
parentFolder.CreateNewSubFolder(folderID, folderName, folderType);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void HandleFecthInventoryDescendents(IClientAPI remoteClient, LLUUID folderID, LLUUID ownerID, bool fetchFolders, bool fetchItems, int sortOrder)
|
||||||
|
{
|
||||||
|
if (this.UserProfiles.ContainsKey(remoteClient.AgentId))
|
||||||
|
{
|
||||||
|
CachedUserInfo userInfo = this.UserProfiles[remoteClient.AgentId];
|
||||||
|
if (userInfo.RootFolder.folderID == folderID)
|
||||||
|
{
|
||||||
|
if (fetchItems)
|
||||||
|
{
|
||||||
|
remoteClient.SendInventoryFolderDetails(remoteClient.AgentId, folderID, userInfo.RootFolder.RequestListOfItems());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
InventoryFolder parentFolder = userInfo.RootFolder.HasSubFolder(folderID);
|
||||||
|
if(parentFolder != null)
|
||||||
|
{
|
||||||
|
if(fetchItems)
|
||||||
|
{
|
||||||
|
remoteClient.SendInventoryFolderDetails(remoteClient.AgentId, folderID, parentFolder.RequestListOfItems());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Request the user profile from User server
|
/// Request the user profile from User server
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -81,9 +131,20 @@ namespace OpenSim.Framework.Communications.Caches
|
||||||
/// Request Iventory Info from Inventory server
|
/// Request Iventory Info from Inventory server
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="userID"></param>
|
/// <param name="userID"></param>
|
||||||
private void RequestInventoryForUser(LLUUID userID)
|
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 rootFolder = new InventoryFolder();
|
||||||
|
rootFolder.agentID = userID;
|
||||||
|
rootFolder.folderID = userInfo.UserProfile.rootInventoryFolderID;
|
||||||
|
rootFolder.name = "My Inventory";
|
||||||
|
rootFolder.parentID = LLUUID.Zero;
|
||||||
|
rootFolder.type = 8;
|
||||||
|
rootFolder.version = 1;
|
||||||
|
userInfo.FolderReceive(userID, rootFolder);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -81,6 +81,8 @@ namespace OpenSim.Framework.Data
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int lastLogin;
|
public int lastLogin;
|
||||||
|
|
||||||
|
public LLUUID rootInventoryFolderID;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A URI to the users inventory server, used for foreigners and large grids
|
/// A URI to the users inventory server, used for foreigners and large grids
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -52,12 +52,11 @@ namespace OpenSim.Framework.Inventory
|
||||||
|
|
||||||
public virtual void Initialise()
|
public virtual void Initialise()
|
||||||
{
|
{
|
||||||
Wearables = new AvatarWearable[13]; //should be 12 of these
|
Wearables = new AvatarWearable[13];
|
||||||
for (int i = 0; i < 13; i++)
|
for (int i = 0; i < 13; i++)
|
||||||
{
|
{
|
||||||
Wearables[i] = new AvatarWearable();
|
Wearables[i] = new AvatarWearable();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool CreateNewFolder(LLUUID folderID, ushort type)
|
public bool CreateNewFolder(LLUUID folderID, ushort type)
|
||||||
|
@ -96,11 +95,10 @@ namespace OpenSim.Framework.Inventory
|
||||||
Folder.DefaultType = type;
|
Folder.DefaultType = type;
|
||||||
Folder.FolderName = folderName;
|
Folder.FolderName = folderName;
|
||||||
this.InventoryFolders.Add(Folder.FolderID, Folder);
|
this.InventoryFolders.Add(Folder.FolderID, Folder);
|
||||||
|
|
||||||
return (true);
|
return (true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool CreateNewFolder(LLUUID folderID, ushort type, string folderName, LLUUID parent)
|
public bool CreateNewFolder(LLUUID folderID, ushort type, string folderName, LLUUID parentID)
|
||||||
{
|
{
|
||||||
if (!this.InventoryFolders.ContainsKey(folderID))
|
if (!this.InventoryFolders.ContainsKey(folderID))
|
||||||
{
|
{
|
||||||
|
@ -110,10 +108,9 @@ namespace OpenSim.Framework.Inventory
|
||||||
Folder.OwnerID = this.AgentID;
|
Folder.OwnerID = this.AgentID;
|
||||||
Folder.DefaultType = type;
|
Folder.DefaultType = type;
|
||||||
Folder.FolderName = folderName;
|
Folder.FolderName = folderName;
|
||||||
Folder.ParentID = parent;
|
Folder.ParentID = parentID;
|
||||||
this.InventoryFolders.Add(Folder.FolderID, Folder);
|
this.InventoryFolders.Add(Folder.FolderID, Folder);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (true);
|
return (true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -135,7 +132,6 @@ namespace OpenSim.Framework.Inventory
|
||||||
return inv.FolderID;
|
return inv.FolderID;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return LLUUID.Zero;
|
return LLUUID.Zero;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -80,7 +80,10 @@ namespace OpenSim.Framework.Interfaces
|
||||||
|
|
||||||
public delegate void AddNewPrim(LLUUID ownerID, LLVector3 pos, PrimitiveBaseShape shape);
|
public delegate void AddNewPrim(LLUUID ownerID, LLVector3 pos, PrimitiveBaseShape shape);
|
||||||
|
|
||||||
|
public delegate void CreateInventoryFolder(IClientAPI remoteClient, LLUUID folderID, ushort folderType, string folderName, LLUUID parentID);
|
||||||
|
public delegate void FetchInventoryDescendents(IClientAPI remoteClient, LLUUID folderID, LLUUID ownerID, bool fetchFolders, bool fetchItems, int sortOrder);
|
||||||
|
|
||||||
|
public delegate void RequestTaskInventory(IClientAPI remoteClient, uint localID);
|
||||||
|
|
||||||
public interface IClientAPI
|
public interface IClientAPI
|
||||||
{
|
{
|
||||||
|
@ -125,6 +128,10 @@ namespace OpenSim.Framework.Interfaces
|
||||||
event NewAvatar OnNewAvatar;
|
event NewAvatar OnNewAvatar;
|
||||||
event GenericCall6 OnRemoveAvatar;
|
event GenericCall6 OnRemoveAvatar;
|
||||||
|
|
||||||
|
event CreateInventoryFolder OnCreateNewInventoryFolder;
|
||||||
|
event FetchInventoryDescendents OnFetchInventoryDescendents;
|
||||||
|
event RequestTaskInventory OnRequestTaskInventory;
|
||||||
|
|
||||||
event UUIDNameRequest OnNameFromUUIDRequest;
|
event UUIDNameRequest OnNameFromUUIDRequest;
|
||||||
|
|
||||||
event ParcelPropertiesRequest OnParcelPropertiesRequest;
|
event ParcelPropertiesRequest OnParcelPropertiesRequest;
|
||||||
|
@ -188,8 +195,10 @@ namespace OpenSim.Framework.Interfaces
|
||||||
|
|
||||||
void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List<InventoryItemBase> items);
|
void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List<InventoryItemBase> items);
|
||||||
void SendInventoryItemDetails(LLUUID ownerID, LLUUID folderID, InventoryItemBase item);
|
void SendInventoryItemDetails(LLUUID ownerID, LLUUID folderID, InventoryItemBase item);
|
||||||
void SendNameReply(LLUUID profileId, string firstname, string lastname);
|
void SendInventoryItemUpdate(InventoryItemBase Item);
|
||||||
|
void SendTaskInventory(LLUUID taskID, short serial, byte[] fileName);
|
||||||
|
|
||||||
|
void SendNameReply(LLUUID profileId, string firstname, string lastname);
|
||||||
void SendAlertMessage(string message);
|
void SendAlertMessage(string message);
|
||||||
void SendAgentAlertMessage(string message, bool modal);
|
void SendAgentAlertMessage(string message, bool modal);
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,6 +52,10 @@ namespace OpenSim.Framework
|
||||||
public event NewAvatar OnNewAvatar;
|
public event NewAvatar OnNewAvatar;
|
||||||
public event GenericCall6 OnRemoveAvatar;
|
public event GenericCall6 OnRemoveAvatar;
|
||||||
|
|
||||||
|
public event CreateInventoryFolder OnCreateNewInventoryFolder;
|
||||||
|
public event FetchInventoryDescendents OnFetchInventoryDescendents;
|
||||||
|
public event RequestTaskInventory OnRequestTaskInventory;
|
||||||
|
|
||||||
public event UUIDNameRequest OnNameFromUUIDRequest;
|
public event UUIDNameRequest OnNameFromUUIDRequest;
|
||||||
|
|
||||||
public event ParcelPropertiesRequest OnParcelPropertiesRequest;
|
public event ParcelPropertiesRequest OnParcelPropertiesRequest;
|
||||||
|
@ -124,8 +128,10 @@ namespace OpenSim.Framework
|
||||||
|
|
||||||
public virtual void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List<InventoryItemBase> items){}
|
public virtual void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List<InventoryItemBase> items){}
|
||||||
public virtual void SendInventoryItemDetails(LLUUID ownerID, LLUUID folderID, InventoryItemBase item){}
|
public virtual void SendInventoryItemDetails(LLUUID ownerID, LLUUID folderID, InventoryItemBase item){}
|
||||||
public virtual void SendNameReply(LLUUID profileId, string firstname, string lastname){}
|
public virtual void SendInventoryItemUpdate(InventoryItemBase Item) { }
|
||||||
|
public virtual void SendTaskInventory(LLUUID taskID, short serial, byte[] fileName) { }
|
||||||
|
|
||||||
|
public virtual void SendNameReply(LLUUID profileId, string firstname, string lastname){}
|
||||||
public void SendAlertMessage(string message) { }
|
public void SendAlertMessage(string message) { }
|
||||||
public void SendAgentAlertMessage(string message, bool modal) { }
|
public void SendAgentAlertMessage(string message, bool modal) { }
|
||||||
}
|
}
|
||||||
|
|
|
@ -417,7 +417,7 @@ namespace OpenSim.Framework.UserManagement
|
||||||
Hashtable TempHash;
|
Hashtable TempHash;
|
||||||
|
|
||||||
AgentInventory Library = new AgentInventory();
|
AgentInventory Library = new AgentInventory();
|
||||||
Library.CreateRootFolder(AgentID, true);
|
Library.CreateRootFolder(AgentID, false);
|
||||||
|
|
||||||
foreach (InventoryFolder InvFolder in Library.InventoryFolders.Values)
|
foreach (InventoryFolder InvFolder in Library.InventoryFolders.Values)
|
||||||
{
|
{
|
||||||
|
@ -434,6 +434,7 @@ namespace OpenSim.Framework.UserManagement
|
||||||
InventoryRootHash["folder_id"] = Library.InventoryRoot.FolderID.ToStringHyphenated();
|
InventoryRootHash["folder_id"] = Library.InventoryRoot.FolderID.ToStringHyphenated();
|
||||||
ArrayList InventoryRoot = new ArrayList();
|
ArrayList InventoryRoot = new ArrayList();
|
||||||
InventoryRoot.Add(InventoryRootHash);
|
InventoryRoot.Add(InventoryRootHash);
|
||||||
|
userProfile.rootInventoryFolderID = Library.InventoryRoot.FolderID;
|
||||||
|
|
||||||
// Circuit Code
|
// Circuit Code
|
||||||
uint circode = (uint)(Util.RandomClass.Next());
|
uint circode = (uint)(Util.RandomClass.Next());
|
||||||
|
|
|
@ -38,7 +38,7 @@ using OpenSim.Region.Caches;
|
||||||
|
|
||||||
namespace OpenSim.Region.Capabilities
|
namespace OpenSim.Region.Capabilities
|
||||||
{
|
{
|
||||||
public delegate void UpLoadedTexture(LLUUID assetID, LLUUID inventoryItem, byte[] data);
|
public delegate void UpLoadedTexture(string assetName, LLUUID assetID, LLUUID inventoryItem, byte[] data);
|
||||||
|
|
||||||
public class Caps
|
public class Caps
|
||||||
{
|
{
|
||||||
|
@ -223,12 +223,14 @@ namespace OpenSim.Region.Capabilities
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public LLSDAssetUploadResponse NewAgentInventoryRequest(LLSDAssetUploadRequest llsdRequest)
|
public LLSDAssetUploadResponse NewAgentInventoryRequest(LLSDAssetUploadRequest llsdRequest)
|
||||||
{
|
{
|
||||||
|
// Console.WriteLine("asset upload request via CAPS");
|
||||||
|
string assetName = llsdRequest.name;
|
||||||
string capsBase = "/CAPS/" + m_capsObjectPath;
|
string capsBase = "/CAPS/" + m_capsObjectPath;
|
||||||
LLUUID newAsset = LLUUID.Random();
|
LLUUID newAsset = LLUUID.Random();
|
||||||
LLUUID newInvItem = LLUUID.Random();
|
LLUUID newInvItem = LLUUID.Random();
|
||||||
string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000");
|
string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000");
|
||||||
|
|
||||||
AssetUploader uploader = new AssetUploader(newAsset, newInvItem, capsBase + uploaderPath, this.httpListener);
|
AssetUploader uploader = new AssetUploader(assetName, newAsset, newInvItem, capsBase + uploaderPath, this.httpListener);
|
||||||
httpListener.AddStreamHandler(new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps));
|
httpListener.AddStreamHandler(new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps));
|
||||||
string uploaderURL = "http://" + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + capsBase + uploaderPath;
|
string uploaderURL = "http://" + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + capsBase + uploaderPath;
|
||||||
|
|
||||||
|
@ -245,14 +247,14 @@ namespace OpenSim.Region.Capabilities
|
||||||
/// <param name="assetID"></param>
|
/// <param name="assetID"></param>
|
||||||
/// <param name="inventoryItem"></param>
|
/// <param name="inventoryItem"></param>
|
||||||
/// <param name="data"></param>
|
/// <param name="data"></param>
|
||||||
public void UploadCompleteHandler(LLUUID assetID, LLUUID inventoryItem, byte[] data)
|
public void UploadCompleteHandler(string assetName, LLUUID assetID, LLUUID inventoryItem, byte[] data)
|
||||||
{
|
{
|
||||||
AssetBase asset;
|
AssetBase asset;
|
||||||
asset = new AssetBase();
|
asset = new AssetBase();
|
||||||
asset.FullID = assetID;
|
asset.FullID = assetID;
|
||||||
asset.Type = 0;
|
asset.Type = 0;
|
||||||
asset.InvType = 0;
|
asset.InvType = 0;
|
||||||
asset.Name = "UploadedTexture" + Util.RandomClass.Next(1, 1000).ToString("000");
|
asset.Name = assetName; //"UploadedTexture" + Util.RandomClass.Next(1, 1000).ToString("000");
|
||||||
asset.Data = data;
|
asset.Data = data;
|
||||||
this.assetCache.AddAsset(asset);
|
this.assetCache.AddAsset(asset);
|
||||||
}
|
}
|
||||||
|
@ -265,6 +267,8 @@ namespace OpenSim.Region.Capabilities
|
||||||
private LLUUID newAssetID;
|
private LLUUID newAssetID;
|
||||||
private LLUUID inventoryItemID;
|
private LLUUID inventoryItemID;
|
||||||
private BaseHttpServer httpListener;
|
private BaseHttpServer httpListener;
|
||||||
|
private bool SaveImages = true;
|
||||||
|
private string m_assetName = "";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
|
@ -273,8 +277,9 @@ namespace OpenSim.Region.Capabilities
|
||||||
/// <param name="inventoryItem"></param>
|
/// <param name="inventoryItem"></param>
|
||||||
/// <param name="path"></param>
|
/// <param name="path"></param>
|
||||||
/// <param name="httpServer"></param>
|
/// <param name="httpServer"></param>
|
||||||
public AssetUploader(LLUUID assetID, LLUUID inventoryItem, string path, BaseHttpServer httpServer)
|
public AssetUploader(string assetName, LLUUID assetID, LLUUID inventoryItem, string path, BaseHttpServer httpServer)
|
||||||
{
|
{
|
||||||
|
m_assetName = assetName;
|
||||||
newAssetID = assetID;
|
newAssetID = assetID;
|
||||||
inventoryItemID = inventoryItem;
|
inventoryItemID = inventoryItem;
|
||||||
uploaderPath = path;
|
uploaderPath = path;
|
||||||
|
@ -300,12 +305,26 @@ namespace OpenSim.Region.Capabilities
|
||||||
|
|
||||||
httpListener.RemoveStreamHandler("POST", uploaderPath);
|
httpListener.RemoveStreamHandler("POST", uploaderPath);
|
||||||
|
|
||||||
|
if(this.SaveImages)
|
||||||
|
this.SaveImageToFile(m_assetName + ".jp2", data);
|
||||||
|
|
||||||
if (OnUpLoad != null)
|
if (OnUpLoad != null)
|
||||||
{
|
{
|
||||||
OnUpLoad(newAssetID, inv, data);
|
OnUpLoad(m_assetName, newAssetID, inv, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void SaveImageToFile(string filename, byte[] data)
|
||||||
|
{
|
||||||
|
|
||||||
|
FileStream fs = File.Create(filename);
|
||||||
|
BinaryWriter bw = new BinaryWriter(fs);
|
||||||
|
bw.Write(data);
|
||||||
|
bw.Close();
|
||||||
|
fs.Close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,6 +81,10 @@ namespace OpenSim.Region.ClientStack
|
||||||
public event RequestMapBlocks OnRequestMapBlocks;
|
public event RequestMapBlocks OnRequestMapBlocks;
|
||||||
public event TeleportLocationRequest OnTeleportLocationRequest;
|
public event TeleportLocationRequest OnTeleportLocationRequest;
|
||||||
|
|
||||||
|
public event CreateInventoryFolder OnCreateNewInventoryFolder;
|
||||||
|
public event FetchInventoryDescendents OnFetchInventoryDescendents;
|
||||||
|
public event RequestTaskInventory OnRequestTaskInventory;
|
||||||
|
|
||||||
public event UUIDNameRequest OnNameFromUUIDRequest;
|
public event UUIDNameRequest OnNameFromUUIDRequest;
|
||||||
|
|
||||||
public event ParcelPropertiesRequest OnParcelPropertiesRequest;
|
public event ParcelPropertiesRequest OnParcelPropertiesRequest;
|
||||||
|
@ -577,6 +581,48 @@ namespace OpenSim.Region.ClientStack
|
||||||
this.OutPacket(inventoryReply);
|
this.OutPacket(inventoryReply);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SendInventoryItemUpdate(InventoryItemBase Item)
|
||||||
|
{
|
||||||
|
Encoding enc = Encoding.ASCII;
|
||||||
|
uint FULL_MASK_PERMISSIONS = 2147483647;
|
||||||
|
UpdateCreateInventoryItemPacket InventoryReply = new UpdateCreateInventoryItemPacket();
|
||||||
|
InventoryReply.AgentData.AgentID = this.AgentID;
|
||||||
|
InventoryReply.AgentData.SimApproved = true;
|
||||||
|
InventoryReply.InventoryData = new UpdateCreateInventoryItemPacket.InventoryDataBlock[1];
|
||||||
|
InventoryReply.InventoryData[0] = new UpdateCreateInventoryItemPacket.InventoryDataBlock();
|
||||||
|
InventoryReply.InventoryData[0].ItemID = Item.inventoryID;
|
||||||
|
InventoryReply.InventoryData[0].AssetID = Item.assetID;
|
||||||
|
InventoryReply.InventoryData[0].CreatorID = Item.creatorsID;
|
||||||
|
InventoryReply.InventoryData[0].BaseMask = FULL_MASK_PERMISSIONS;
|
||||||
|
InventoryReply.InventoryData[0].CreationDate = 1000;
|
||||||
|
InventoryReply.InventoryData[0].Description = enc.GetBytes(Item.inventoryDescription + "\0");
|
||||||
|
InventoryReply.InventoryData[0].EveryoneMask = FULL_MASK_PERMISSIONS;
|
||||||
|
InventoryReply.InventoryData[0].Flags = 0;
|
||||||
|
InventoryReply.InventoryData[0].FolderID = Item.parentFolderID;
|
||||||
|
InventoryReply.InventoryData[0].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000");
|
||||||
|
InventoryReply.InventoryData[0].GroupMask = FULL_MASK_PERMISSIONS;
|
||||||
|
InventoryReply.InventoryData[0].InvType =(sbyte) Item.type;
|
||||||
|
InventoryReply.InventoryData[0].Name = enc.GetBytes(Item.inventoryName + "\0");
|
||||||
|
InventoryReply.InventoryData[0].NextOwnerMask = FULL_MASK_PERMISSIONS;
|
||||||
|
InventoryReply.InventoryData[0].OwnerID = Item.avatarID;
|
||||||
|
InventoryReply.InventoryData[0].OwnerMask = FULL_MASK_PERMISSIONS;
|
||||||
|
InventoryReply.InventoryData[0].SalePrice = 100;
|
||||||
|
InventoryReply.InventoryData[0].SaleType = 0;
|
||||||
|
InventoryReply.InventoryData[0].Type =(sbyte) Item.type;
|
||||||
|
InventoryReply.InventoryData[0].CRC = Helpers.InventoryCRC(1000, 0, InventoryReply.InventoryData[0].InvType, InventoryReply.InventoryData[0].Type, InventoryReply.InventoryData[0].AssetID, InventoryReply.InventoryData[0].GroupID, 100, InventoryReply.InventoryData[0].OwnerID, InventoryReply.InventoryData[0].CreatorID, InventoryReply.InventoryData[0].ItemID, InventoryReply.InventoryData[0].FolderID, FULL_MASK_PERMISSIONS, 1, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS);
|
||||||
|
|
||||||
|
OutPacket(InventoryReply);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SendTaskInventory(LLUUID taskID, short serial, byte[] fileName)
|
||||||
|
{
|
||||||
|
ReplyTaskInventoryPacket replytask = new ReplyTaskInventoryPacket();
|
||||||
|
replytask.InventoryData.TaskID = taskID;
|
||||||
|
replytask.InventoryData.Serial = serial;
|
||||||
|
replytask.InventoryData.Filename = fileName;
|
||||||
|
OutPacket(replytask);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -373,7 +373,8 @@ namespace OpenSim.Region.ClientStack
|
||||||
break;
|
break;
|
||||||
case PacketType.AssetUploadRequest:
|
case PacketType.AssetUploadRequest:
|
||||||
AssetUploadRequestPacket request = (AssetUploadRequestPacket)Pack;
|
AssetUploadRequestPacket request = (AssetUploadRequestPacket)Pack;
|
||||||
this.UploadAssets.HandleUploadPacket(request, request.AssetBlock.TransactionID.Combine(this.SecureSessionID));
|
// Console.WriteLine(request.ToString());
|
||||||
|
//this.UploadAssets.HandleUploadPacket(request, request.AssetBlock.TransactionID.Combine(this.SecureSessionID));
|
||||||
break;
|
break;
|
||||||
case PacketType.RequestXfer:
|
case PacketType.RequestXfer:
|
||||||
//Console.WriteLine(Pack.ToString());
|
//Console.WriteLine(Pack.ToString());
|
||||||
|
@ -382,9 +383,12 @@ namespace OpenSim.Region.ClientStack
|
||||||
this.UploadAssets.HandleXferPacket((SendXferPacketPacket)Pack);
|
this.UploadAssets.HandleXferPacket((SendXferPacketPacket)Pack);
|
||||||
break;
|
break;
|
||||||
case PacketType.CreateInventoryFolder:
|
case PacketType.CreateInventoryFolder:
|
||||||
|
if (this.OnCreateNewInventoryFolder != null)
|
||||||
|
{
|
||||||
CreateInventoryFolderPacket invFolder = (CreateInventoryFolderPacket)Pack;
|
CreateInventoryFolderPacket invFolder = (CreateInventoryFolderPacket)Pack;
|
||||||
m_inventoryCache.CreateNewInventoryFolder(this, invFolder.FolderData.FolderID, (ushort)invFolder.FolderData.Type, Util.FieldToString(invFolder.FolderData.Name), invFolder.FolderData.ParentID);
|
this.OnCreateNewInventoryFolder(this, invFolder.FolderData.FolderID, (ushort)invFolder.FolderData.Type, Util.FieldToString(invFolder.FolderData.Name), invFolder.FolderData.ParentID);
|
||||||
//Console.WriteLine(Pack.ToString());
|
//m_inventoryCache.CreateNewInventoryFolder(this, invFolder.FolderData.FolderID, (ushort)invFolder.FolderData.Type, Util.FieldToString(invFolder.FolderData.Name), invFolder.FolderData.ParentID);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case PacketType.CreateInventoryItem:
|
case PacketType.CreateInventoryItem:
|
||||||
//Console.WriteLine(Pack.ToString());
|
//Console.WriteLine(Pack.ToString());
|
||||||
|
@ -405,8 +409,12 @@ namespace OpenSim.Region.ClientStack
|
||||||
m_inventoryCache.FetchInventory(this, FetchInventory);
|
m_inventoryCache.FetchInventory(this, FetchInventory);
|
||||||
break;
|
break;
|
||||||
case PacketType.FetchInventoryDescendents:
|
case PacketType.FetchInventoryDescendents:
|
||||||
|
if (this.OnFetchInventoryDescendents != null)
|
||||||
|
{
|
||||||
FetchInventoryDescendentsPacket Fetch = (FetchInventoryDescendentsPacket)Pack;
|
FetchInventoryDescendentsPacket Fetch = (FetchInventoryDescendentsPacket)Pack;
|
||||||
m_inventoryCache.FetchInventoryDescendents(this, Fetch);
|
// m_inventoryCache.FetchInventoryDescendents(this, Fetch);
|
||||||
|
this.OnFetchInventoryDescendents(this, Fetch.InventoryData.FolderID, Fetch.InventoryData.OwnerID, Fetch.InventoryData.FetchFolders, Fetch.InventoryData.FetchItems, Fetch.InventoryData.SortOrder);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case PacketType.UpdateInventoryItem:
|
case PacketType.UpdateInventoryItem:
|
||||||
UpdateInventoryItemPacket update = (UpdateInventoryItemPacket)Pack;
|
UpdateInventoryItemPacket update = (UpdateInventoryItemPacket)Pack;
|
||||||
|
@ -444,22 +452,10 @@ namespace OpenSim.Region.ClientStack
|
||||||
case PacketType.RequestTaskInventory:
|
case PacketType.RequestTaskInventory:
|
||||||
// Console.WriteLine(Pack.ToString());
|
// Console.WriteLine(Pack.ToString());
|
||||||
RequestTaskInventoryPacket requesttask = (RequestTaskInventoryPacket)Pack;
|
RequestTaskInventoryPacket requesttask = (RequestTaskInventoryPacket)Pack;
|
||||||
ReplyTaskInventoryPacket replytask = new ReplyTaskInventoryPacket();
|
if (this.OnRequestTaskInventory != null)
|
||||||
//bool foundent = false;
|
|
||||||
/* foreach (Entity ent in m_world.Entities.Values)
|
|
||||||
{
|
{
|
||||||
if (ent.localid == requesttask.InventoryData.LocalID)
|
this.OnRequestTaskInventory(this, requesttask.InventoryData.LocalID);
|
||||||
{
|
|
||||||
replytask.InventoryData.TaskID = ent.uuid;
|
|
||||||
replytask.InventoryData.Serial = 0;
|
|
||||||
replytask.InventoryData.Filename = new byte[0];
|
|
||||||
foundent = true;
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (foundent)
|
|
||||||
{
|
|
||||||
this.OutPacket(replytask);
|
|
||||||
}*/
|
|
||||||
break;
|
break;
|
||||||
case PacketType.UpdateTaskInventory:
|
case PacketType.UpdateTaskInventory:
|
||||||
// Console.WriteLine(Pack.ToString());
|
// Console.WriteLine(Pack.ToString());
|
||||||
|
|
|
@ -529,6 +529,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
m_estateManager.sendRegionHandshake(client);
|
m_estateManager.sendRegionHandshake(client);
|
||||||
CreateAndAddScenePresence(client);
|
CreateAndAddScenePresence(client);
|
||||||
m_LandManager.sendParcelOverlay(client);
|
m_LandManager.sendParcelOverlay(client);
|
||||||
|
//commsManager.UserProfilesCache.AddNewUser(client.AgentId);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual void SubscribeToClientEvents(IClientAPI client)
|
protected virtual void SubscribeToClientEvents(IClientAPI client)
|
||||||
|
@ -569,6 +570,9 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
new ParcelObjectOwnerRequest(m_LandManager.handleParcelObjectOwnersRequest);
|
new ParcelObjectOwnerRequest(m_LandManager.handleParcelObjectOwnersRequest);
|
||||||
|
|
||||||
client.OnEstateOwnerMessage += new EstateOwnerMessageRequest(m_estateManager.handleEstateOwnerMessage);
|
client.OnEstateOwnerMessage += new EstateOwnerMessageRequest(m_estateManager.handleEstateOwnerMessage);
|
||||||
|
|
||||||
|
//client.OnCreateNewInventoryFolder += commsManager.UserProfilesCache.HandleCreateInventoryFolder;
|
||||||
|
// client.OnFetchInventoryDescendents += commsManager.UserProfilesCache.HandleFecthInventoryDescendents;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ScenePresence CreateAndAddScenePresence(IClientAPI client)
|
protected ScenePresence CreateAndAddScenePresence(IClientAPI client)
|
||||||
|
|
|
@ -53,7 +53,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
private List<NewForce> forcesList = new List<NewForce>();
|
private List<NewForce> forcesList = new List<NewForce>();
|
||||||
private short _updateCount = 0;
|
private short _updateCount = 0;
|
||||||
private Quaternion bodyRot;
|
private Quaternion bodyRot;
|
||||||
private LLObject.TextureEntry avatarAppearanceTexture = null;
|
// private LLObject.TextureEntry avatarAppearanceTexture = null;
|
||||||
private byte[] visualParams;
|
private byte[] visualParams;
|
||||||
private AvatarWearable[] Wearables;
|
private AvatarWearable[] Wearables;
|
||||||
private ulong m_regionHandle;
|
private ulong m_regionHandle;
|
||||||
|
@ -140,7 +140,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
Animations = new ScenePresence.AvatarAnimations();
|
Animations = new ScenePresence.AvatarAnimations();
|
||||||
Animations.LoadAnims();
|
Animations.LoadAnims();
|
||||||
|
|
||||||
this.avatarAppearanceTexture = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-5005-000000000005"));
|
// this.avatarAppearanceTexture = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-5005-000000000005"));
|
||||||
|
|
||||||
//register for events
|
//register for events
|
||||||
ControllingClient.OnRequestWearables += this.SendOurAppearance;
|
ControllingClient.OnRequestWearables += this.SendOurAppearance;
|
||||||
|
@ -605,6 +605,8 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
br.Close();
|
br.Close();
|
||||||
fStream.Close();
|
fStream.Close();
|
||||||
DefaultTexture = data1;
|
DefaultTexture = data1;
|
||||||
|
// LLObject.TextureEntry textu = new LLObject.TextureEntry(data1, 0, data1.Length);
|
||||||
|
// Console.WriteLine("default texture entry: " + textu.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
public class NewForce
|
public class NewForce
|
||||||
|
|
|
@ -66,6 +66,10 @@ namespace SimpleApp
|
||||||
public event NewAvatar OnNewAvatar;
|
public event NewAvatar OnNewAvatar;
|
||||||
public event GenericCall6 OnRemoveAvatar;
|
public event GenericCall6 OnRemoveAvatar;
|
||||||
|
|
||||||
|
public event CreateInventoryFolder OnCreateNewInventoryFolder;
|
||||||
|
public event FetchInventoryDescendents OnFetchInventoryDescendents;
|
||||||
|
public event RequestTaskInventory OnRequestTaskInventory;
|
||||||
|
|
||||||
public event UUIDNameRequest OnNameFromUUIDRequest;
|
public event UUIDNameRequest OnNameFromUUIDRequest;
|
||||||
|
|
||||||
public event ParcelPropertiesRequest OnParcelPropertiesRequest;
|
public event ParcelPropertiesRequest OnParcelPropertiesRequest;
|
||||||
|
@ -139,6 +143,8 @@ namespace SimpleApp
|
||||||
|
|
||||||
public virtual void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List<InventoryItemBase> items) { }
|
public virtual void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List<InventoryItemBase> items) { }
|
||||||
public virtual void SendInventoryItemDetails(LLUUID ownerID, LLUUID folderID, InventoryItemBase item) { }
|
public virtual void SendInventoryItemDetails(LLUUID ownerID, LLUUID folderID, InventoryItemBase item) { }
|
||||||
|
public virtual void SendInventoryItemUpdate(InventoryItemBase Item) { }
|
||||||
|
public virtual void SendTaskInventory(LLUUID taskID, short serial, byte[] fileName) { }
|
||||||
public virtual void SendNameReply(LLUUID profileId, string firstname, string lastname) { }
|
public virtual void SendNameReply(LLUUID profileId, string firstname, string lastname) { }
|
||||||
|
|
||||||
public void SendAlertMessage(string message) { }
|
public void SendAlertMessage(string message) { }
|
||||||
|
|
|
@ -246,6 +246,18 @@ namespace OpenSim.Region.GridInterfaces.Local
|
||||||
db.Set(store);
|
db.Set(store);
|
||||||
db.Commit();
|
db.Commit();
|
||||||
|
|
||||||
|
/*
|
||||||
|
Image = new AssetBase();
|
||||||
|
Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000008");
|
||||||
|
Image.Name = "Default Avatar Face";
|
||||||
|
this.LoadAsset(Image, true, "femaleface.j2c");
|
||||||
|
store = new AssetStorage();
|
||||||
|
store.Data = Image.Data;
|
||||||
|
store.Name = Image.Name;
|
||||||
|
store.UUID = Image.FullID;
|
||||||
|
db.Set(store);
|
||||||
|
db.Commit();*/
|
||||||
|
|
||||||
Image = new AssetBase();
|
Image = new AssetBase();
|
||||||
Image.FullID = new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73");
|
Image.FullID = new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73");
|
||||||
Image.Name = "Shape";
|
Image.Name = "Shape";
|
||||||
|
|
Loading…
Reference in New Issue