From 94dded470d04f72c573bf0aa82e1f7522362c54a Mon Sep 17 00:00:00 2001
From: MW
Date: Wed, 15 Aug 2007 18:34:36 +0000
Subject: More work on inventory, can now create other inventory types, like
Clothes and body parts. [Note while you can edit these, at the moment your
changes won't be saved between restarts. This will be fixed very soon.]
---
OpenSim/Region/ClientStack/ClientView.API.cs | 2 +
.../ClientStack/ClientView.ProcessPackets.cs | 35 ++++++-------
.../Communications/Local/CommunicationsLocal.cs | 4 ++
.../Communications/Local/LocalLoginService.cs | 1 +
.../Environment/Scenes/Scene.PacketHandlers.cs | 60 ++++++++++++----------
OpenSim/Region/Environment/Scenes/Scene.cs | 3 ++
.../Region/Environment/Scenes/SceneObjectGroup.cs | 1 -
.../Region/Examples/SimpleApp/MyNpcCharacter.cs | 2 +
8 files changed, 63 insertions(+), 45 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/ClientStack/ClientView.API.cs b/OpenSim/Region/ClientStack/ClientView.API.cs
index d9c7508..d7962dc 100644
--- a/OpenSim/Region/ClientStack/ClientView.API.cs
+++ b/OpenSim/Region/ClientStack/ClientView.API.cs
@@ -86,6 +86,8 @@ namespace OpenSim.Region.ClientStack
public event FetchInventoryDescendents OnFetchInventoryDescendents;
public event FetchInventory OnFetchInventory;
public event RequestTaskInventory OnRequestTaskInventory;
+ public event UDPAssetUploadRequest OnAssetUploadRequest;
+ public event XferReceive OnXferReceive;
public event UUIDNameRequest OnNameFromUUIDRequest;
diff --git a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs
index 58d4cfe..1e3685b 100644
--- a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs
+++ b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs
@@ -217,7 +217,7 @@ namespace OpenSim.Region.ClientStack
case PacketType.ObjectAdd:
if (OnAddPrim != null)
{
- ObjectAddPacket addPacket = (ObjectAddPacket) Pack ;
+ ObjectAddPacket addPacket = (ObjectAddPacket)Pack;
PrimitiveBaseShape shape = GetShapeFromAddPacket(addPacket);
OnAddPrim(this.AgentId, addPacket.ObjectData.RayEnd, shape);
@@ -290,7 +290,7 @@ namespace OpenSim.Region.ClientStack
}
break;
case PacketType.ObjectGrab:
- ObjectGrabPacket grab = (ObjectGrabPacket)Pack;
+ ObjectGrabPacket grab = (ObjectGrabPacket)Pack;
if (OnGrabObject != null)
{
OnGrabObject(grab.ObjectData.LocalID, grab.ObjectData.GrabOffset, this);
@@ -338,7 +338,7 @@ namespace OpenSim.Region.ClientStack
#region Inventory/Asset/Other related packets
case PacketType.RequestImage:
RequestImagePacket imageRequest = (RequestImagePacket)Pack;
-
+
for (int i = 0; i < imageRequest.RequestImage.Length; i++)
{
m_assetCache.AddTextureRequest(this, imageRequest.RequestImage[i].Image, imageRequest.RequestImage[i].Packet);
@@ -351,14 +351,20 @@ namespace OpenSim.Region.ClientStack
break;
case PacketType.AssetUploadRequest:
AssetUploadRequestPacket request = (AssetUploadRequestPacket)Pack;
- // Console.WriteLine(request.ToString());
- //this.UploadAssets.HandleUploadPacket(request, request.AssetBlock.TransactionID.Combine(this.SecureSessionID));
+ if (OnAssetUploadRequest != null)
+ {
+ OnAssetUploadRequest(this, request.AssetBlock.TransactionID.Combine(this.SecureSessionID), request.AssetBlock.TransactionID, request.AssetBlock.Type, request.AssetBlock.AssetData);
+ }
break;
case PacketType.RequestXfer:
//Console.WriteLine(Pack.ToString());
break;
case PacketType.SendXferPacket:
- this.UploadAssets.HandleXferPacket((SendXferPacketPacket)Pack);
+ SendXferPacketPacket xferRec = (SendXferPacketPacket)Pack;
+ if (OnXferReceive != null)
+ {
+ OnXferReceive(this, xferRec.XferID.ID, xferRec.XferID.Packet, xferRec.DataPacket.Data);
+ }
break;
case PacketType.CreateInventoryFolder:
if (this.OnCreateNewInventoryFolder != null)
@@ -369,18 +375,11 @@ namespace OpenSim.Region.ClientStack
break;
case PacketType.CreateInventoryItem:
CreateInventoryItemPacket createItem = (CreateInventoryItemPacket)Pack;
- if (createItem.InventoryBlock.TransactionID != LLUUID.Zero)
+ if (this.OnCreateNewInventoryItem != null)
{
- this.UploadAssets.CreateInventoryItem(createItem);
- }
- else
- {
- if (this.OnCreateNewInventoryItem != null)
- {
- this.OnCreateNewInventoryItem(this, createItem.InventoryBlock.TransactionID, createItem.InventoryBlock.FolderID, createItem.InventoryBlock.CallbackID,
- Util.FieldToString(createItem.InventoryBlock.Description), Util.FieldToString(createItem.InventoryBlock.Name), createItem.InventoryBlock.InvType,
- createItem.InventoryBlock.Type, createItem.InventoryBlock.WearableType, createItem.InventoryBlock.NextOwnerMask);
- }
+ this.OnCreateNewInventoryItem(this, createItem.InventoryBlock.TransactionID, createItem.InventoryBlock.FolderID, createItem.InventoryBlock.CallbackID,
+ Util.FieldToString(createItem.InventoryBlock.Description), Util.FieldToString(createItem.InventoryBlock.Name), createItem.InventoryBlock.InvType,
+ createItem.InventoryBlock.Type, createItem.InventoryBlock.WearableType, createItem.InventoryBlock.NextOwnerMask);
}
break;
case PacketType.FetchInventory:
@@ -558,7 +557,7 @@ namespace OpenSim.Region.ClientStack
if (OnParcelPropertiesUpdateRequest != null)
{
OnParcelPropertiesUpdateRequest(updatePacket, this);
-
+
}
break;
case PacketType.ParcelSelectObjects:
diff --git a/OpenSim/Region/Communications/Local/CommunicationsLocal.cs b/OpenSim/Region/Communications/Local/CommunicationsLocal.cs
index e2a953c..9ff9133 100644
--- a/OpenSim/Region/Communications/Local/CommunicationsLocal.cs
+++ b/OpenSim/Region/Communications/Local/CommunicationsLocal.cs
@@ -33,6 +33,7 @@ using OpenSim.Framework.Communications.Caches;
using OpenSim.Framework.Console;
using OpenSim.Framework.Utilities;
using OpenSim.Framework.Data;
+using OpenSim.Framework.UserManagement;
namespace OpenSim.Region.Communications.Local
{
@@ -42,6 +43,7 @@ namespace OpenSim.Region.Communications.Local
public LocalUserServices UserServices;
public LocalLoginService LoginServices;
public LocalInventoryService InvenServices;
+ // public CAPSService CapsServices;
public CommunicationsLocal(NetworkServersInfo serversInfo, BaseHttpServer httpServer, AssetCache assetCache, bool accountsAuthenticate, string welcomeMessage )
: base(serversInfo, httpServer, assetCache)
@@ -57,6 +59,8 @@ namespace OpenSim.Region.Communications.Local
InstanceServices = new LocalBackEndServices();
GridServer = InstanceServices;
InterRegion = InstanceServices;
+
+ //CapsServices = new CAPSService(httpServer);
LoginServices = new LocalLoginService(UserServices, welcomeMessage, this, serversInfo, accountsAuthenticate);
httpServer.AddXmlRPCHandler("login_to_simulator", LoginServices.XmlRpcLoginMethod);
diff --git a/OpenSim/Region/Communications/Local/LocalLoginService.cs b/OpenSim/Region/Communications/Local/LocalLoginService.cs
index 88377bc..d3b76de 100644
--- a/OpenSim/Region/Communications/Local/LocalLoginService.cs
+++ b/OpenSim/Region/Communications/Local/LocalLoginService.cs
@@ -90,6 +90,7 @@ namespace OpenSim.Region.Communications.Local
response.RegionY = reg.RegionLocY;
response.SeedCapability = "http://" + reg.ExternalHostName + ":" + this.serversInfo.HttpListenerPort.ToString() + "/CAPS/" + capsPath + "0000/";
+ // response.SeedCapability = "http://" + reg.ExternalHostName + ":" + this.serversInfo.HttpListenerPort.ToString() + "/CapsSeed/" + capsPath + "0000/";
theUser.currentAgent.currentRegion = reg.SimUUID;
theUser.currentAgent.currentHandle = reg.RegionHandle;
diff --git a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
index cca8998..afa4ea5 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
@@ -714,33 +714,41 @@ namespace OpenSim.Region.Environment.Scenes
///
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.UserProfiles.GetUserDetails(remoteClient.AgentId);
- if (userInfo != null)
+ if (transActionID == LLUUID.Zero)
{
- AssetBase asset = new AssetBase();
- asset.Name = name;
- asset.Description = description;
- asset.InvType = invType;
- asset.Type = type;
- asset.FullID = LLUUID.Random();
- asset.Data = new byte[1];
- this.assetCache.AddAsset(asset);
-
- InventoryItemBase item = new InventoryItemBase();
- item.avatarID = remoteClient.AgentId;
- item.creatorsID = remoteClient.AgentId;
- item.inventoryID = LLUUID.Random();
- item.assetID = asset.FullID;
- item.inventoryDescription = description;
- item.inventoryName = name;
- item.assetType = invType;
- item.invType = invType;
- item.parentFolderID = folderID;
- item.inventoryCurrentPermissions = 2147483647;
- item.inventoryNextPermissions = nextOwnerMask;
-
- userInfo.AddItem(remoteClient.AgentId, item);
- remoteClient.SendInventoryItemUpdate(item);
+ CachedUserInfo userInfo = commsManager.UserProfiles.GetUserDetails(remoteClient.AgentId);
+ if (userInfo != null)
+ {
+ AssetBase asset = new AssetBase();
+ asset.Name = name;
+ asset.Description = description;
+ asset.InvType = invType;
+ asset.Type = type;
+ asset.FullID = LLUUID.Random();
+ asset.Data = new byte[1];
+ this.assetCache.AddAsset(asset);
+
+ InventoryItemBase item = new InventoryItemBase();
+ item.avatarID = remoteClient.AgentId;
+ item.creatorsID = remoteClient.AgentId;
+ item.inventoryID = LLUUID.Random();
+ item.assetID = asset.FullID;
+ item.inventoryDescription = description;
+ item.inventoryName = name;
+ item.assetType = invType;
+ item.invType = invType;
+ item.parentFolderID = folderID;
+ item.inventoryCurrentPermissions = 2147483647;
+ item.inventoryNextPermissions = nextOwnerMask;
+
+ userInfo.AddItem(remoteClient.AgentId, item);
+ remoteClient.SendInventoryItemUpdate(item);
+ }
+ }
+ else
+ {
+ commsManager.TransactionsManager.HandleInventoryFromTransaction(remoteClient, transActionID, folderID, callbackID, description, name, invType, type, wearableType, nextOwnerMask);
+ //System.Console.WriteLine("request to create inventory item from transaction " + transActionID);
}
}
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index 3ee1f19..378acf9 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -577,6 +577,7 @@ namespace OpenSim.Region.Environment.Scenes
CreateAndAddScenePresence(client);
m_LandManager.sendParcelOverlay(client);
commsManager.UserProfiles.AddNewUser(client.AgentId);
+ commsManager.TransactionsManager.AddUser(client.AgentId);
}
protected virtual void SubscribeToClientEvents(IClientAPI client)
@@ -625,6 +626,8 @@ namespace OpenSim.Region.Environment.Scenes
client.OnFetchInventoryDescendents += commsManager.UserProfiles.HandleFecthInventoryDescendents;
client.OnRequestTaskInventory += RequestTaskInventory;
client.OnFetchInventory += commsManager.UserProfiles.HandleFetchInventory;
+ client.OnAssetUploadRequest += commsManager.TransactionsManager.HandleUDPUploadRequest;
+ client.OnXferReceive += commsManager.TransactionsManager.HandleXfer;
client.OnGrabObject += ProcessObjectGrab;
}
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
index 7a1f117..3bd83aa 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
@@ -706,7 +706,6 @@ namespace OpenSim.Region.Environment.Scenes
}
}
}
-
#endregion
///
///
diff --git a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs
index af3d77b..c0132f5 100644
--- a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs
+++ b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs
@@ -71,6 +71,8 @@ namespace SimpleApp
public event FetchInventoryDescendents OnFetchInventoryDescendents;
public event FetchInventory OnFetchInventory;
public event RequestTaskInventory OnRequestTaskInventory;
+ public event UDPAssetUploadRequest OnAssetUploadRequest;
+ public event XferReceive OnXferReceive;
public event UUIDNameRequest OnNameFromUUIDRequest;
--
cgit v1.1