Sqlite datastore should now save the textures and extraparams data (used by sculpties) correctly. [Really need to add a ExtraParams field to the sqlite database though, but for now I have combined their data so that we don't lose backward compatibility, know a couple of people have been using the datastore already].

Now have a rough day/night cycle (the movement of the sun needs to be made smoother but for now it is better than we had I think).
Added dalien's patch (issue 294) for saving and loading prims to a xml file (think he will be modifying these to be import/export functions and maybe writing a xml datastore for backups).
Some preliminary work on task inventory (ie object's/prim's inventory).
Added place holder data for AvatarProperties (ie a avatar's profile). Should we store this sort of data on the user server or have another server for it (a normal webserver should work). 
Added a few more method to IClientAPI.  
Sure there is something I'm forgeting.
afrisby
MW 2007-08-19 13:35:20 +00:00
parent eeaac68d73
commit c89db49f3c
17 changed files with 537 additions and 120 deletions

View File

@ -156,7 +156,7 @@ namespace OpenSim.Framework.Communications.Caches
}
if (this.OnUpLoad != null)
{
this.OnUpLoad(this.m_assetName, "description", this.newAssetID, inventoryItemID, LLUUID.Zero, data);
this.OnUpLoad(this.m_assetName, "description", this.newAssetID, inventoryItemID, LLUUID.Zero, data, "" , "");
}
return text;
}
@ -373,7 +373,7 @@ namespace OpenSim.Framework.Communications.Caches
}
if (this.OnUpLoad != null)
{
this.OnUpLoad(this.m_assetName, "description", this.newAssetID, inventoryItemID, LLUUID.Zero, data);
this.OnUpLoad(this.m_assetName, "description", this.newAssetID, inventoryItemID, LLUUID.Zero, data, "" , "" );
}
return text;
}

View File

@ -39,7 +39,7 @@ using OpenSim.Framework.Data;
namespace OpenSim.Region.Capabilities
{
public delegate void UpLoadedAsset(string assetName, string description, LLUUID assetID, LLUUID inventoryItem, LLUUID parentFolder, byte[] data);
public delegate void UpLoadedAsset(string assetName, string description, LLUUID assetID, LLUUID inventoryItem, LLUUID parentFolder, byte[] data, string inventoryType, string assetType);
public delegate LLUUID UpdateItem(LLUUID itemID, byte[] data);
public delegate void NewInventoryItem(LLUUID userID, InventoryItemBase item);
public delegate LLUUID ItemUpdatedCallback(LLUUID userID, LLUUID itemID, byte[] data);
@ -113,7 +113,7 @@ namespace OpenSim.Region.Capabilities
/// <returns></returns>
public string CapsRequest(string request, string path, string param)
{
//Console.WriteLine("caps request " + request);
// Console.WriteLine("caps request " + request);
string result = LLSDHelpers.SerialiseLLSDReply(this.GetCapabilities());
return result;
}
@ -270,7 +270,7 @@ namespace OpenSim.Region.Capabilities
/// <returns></returns>
public LLSDAssetUploadResponse NewAgentInventoryRequest(LLSDAssetUploadRequest llsdRequest)
{
// Console.WriteLine("asset upload request via CAPS");
//Console.WriteLine("asset upload request via CAPS" + llsdRequest.inventory_type +" , "+ llsdRequest.asset_type);
string assetName = llsdRequest.name;
string assetDes = llsdRequest.description;
@ -280,7 +280,7 @@ namespace OpenSim.Region.Capabilities
LLUUID parentFolder = llsdRequest.folder_id;
string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000");
AssetUploader uploader = new AssetUploader(assetName, assetDes, newAsset, newInvItem, parentFolder, "" , "", capsBase + uploaderPath, this.httpListener);
AssetUploader uploader = new AssetUploader(assetName, assetDes, newAsset, newInvItem, parentFolder, llsdRequest.inventory_type, llsdRequest.asset_type, capsBase + uploaderPath, this.httpListener);
httpListener.AddStreamHandler(new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps));
string uploaderURL = "http://" + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + capsBase + uploaderPath;
@ -297,13 +297,27 @@ namespace OpenSim.Region.Capabilities
/// <param name="assetID"></param>
/// <param name="inventoryItem"></param>
/// <param name="data"></param>
public void UploadCompleteHandler(string assetName, string assetDescription, LLUUID assetID, LLUUID inventoryItem, LLUUID parentFolder, byte[] data)
public void UploadCompleteHandler(string assetName, string assetDescription, LLUUID assetID, LLUUID inventoryItem, LLUUID parentFolder, byte[] data, string inventoryType, string assetType)
{
sbyte assType = 0;
sbyte inType = 0;
if (inventoryType == "sound")
{
inType = 1;
assType = 1;
}
else if (inventoryType == "animation")
{
inType = 19;
assType = 19;
}
AssetBase asset;
asset = new AssetBase();
asset.FullID = assetID;
asset.Type = 0;
asset.InvType = 0;
asset.Type = assType;
asset.InvType = inType;
asset.Name = assetName;
asset.Data = data;
this.assetCache.AddAsset(asset);
@ -315,8 +329,8 @@ namespace OpenSim.Region.Capabilities
item.assetID = asset.FullID;
item.inventoryDescription = assetDescription;
item.inventoryName = assetName;
item.assetType = 0;
item.invType = 0;
item.assetType = assType;
item.invType = inType;
item.parentFolderID = parentFolder;
item.inventoryCurrentPermissions = 2147483647;
item.inventoryNextPermissions = 2147483647;
@ -350,6 +364,9 @@ namespace OpenSim.Region.Capabilities
private string m_assetName = "";
private string m_assetDes = "";
private string m_invType = "";
private string m_assetType = "";
/// <summary>
///
/// </summary>
@ -366,6 +383,9 @@ namespace OpenSim.Region.Capabilities
uploaderPath = path;
httpListener = httpServer;
parentFolder = parentFolderID;
m_assetType = assetType;
m_invType = invType;
}
/// <summary>
@ -393,7 +413,7 @@ namespace OpenSim.Region.Capabilities
if (OnUpLoad != null)
{
OnUpLoad(m_assetName, m_assetDes, newAssetID, inv, parentFolder, data);
OnUpLoad(m_assetName, m_assetDes, newAssetID, inv, parentFolder, data, m_invType, m_assetType);
}
return res;

View File

@ -89,6 +89,7 @@ namespace OpenSim.Framework.Interfaces
public delegate void UDPAssetUploadRequest(IClientAPI remoteClient, LLUUID assetID, LLUUID transaction, sbyte type, byte[] data);
public delegate void XferReceive(IClientAPI remoteClient, ulong xferID, uint packetID, byte[] data);
public delegate void RequestXfer(IClientAPI remoteClient, ulong xferID, string fileName);
public interface IClientAPI
{
@ -140,6 +141,7 @@ namespace OpenSim.Framework.Interfaces
event RequestTaskInventory OnRequestTaskInventory;
event UDPAssetUploadRequest OnAssetUploadRequest;
event XferReceive OnXferReceive;
event RequestXfer OnRequestXfer;
event UUIDNameRequest OnNameFromUUIDRequest;
@ -212,11 +214,17 @@ namespace OpenSim.Framework.Interfaces
void SendInventoryItemUpdate(InventoryItemBase Item);
void SendRemoveInventoryItem(LLUUID itemID);
void SendTaskInventory(LLUUID taskID, short serial, byte[] fileName);
void SendXferPacket(ulong xferID, uint packet, byte[] data);
void SendPreLoadSound(LLUUID objectID, LLUUID ownerID, LLUUID soundID);
void SendPlayAttachedSound(LLUUID soundID, LLUUID objectID, LLUUID ownerID, float gain, byte flags);
void SendNameReply(LLUUID profileId, string firstname, string lastname);
void SendAlertMessage(string message);
void SendAgentAlertMessage(string message, bool modal);
void SendLoadURL(string objectname, LLUUID objectID, LLUUID ownerID, bool groupOwned, string message, string url);
bool AddMoney( int debit );
void SendViewerTime(int phase);
}
}

View File

@ -59,6 +59,7 @@ namespace OpenSim.Framework
public event RequestTaskInventory OnRequestTaskInventory;
public event UDPAssetUploadRequest OnAssetUploadRequest;
public event XferReceive OnXferReceive;
public event RequestXfer OnRequestXfer;
public event UUIDNameRequest OnNameFromUUIDRequest;
@ -140,6 +141,10 @@ namespace OpenSim.Framework
public virtual void SendInventoryItemUpdate(InventoryItemBase Item) { }
public virtual void SendRemoveInventoryItem(LLUUID itemID) { }
public virtual void SendTaskInventory(LLUUID taskID, short serial, byte[] fileName) { }
public virtual void SendXferPacket(ulong xferID, uint packet, byte[] data) { }
public virtual void SendPreLoadSound(LLUUID objectID, LLUUID ownerID, LLUUID soundID) { }
public virtual void SendPlayAttachedSound(LLUUID soundID, LLUUID objectID, LLUUID ownerID, float gain, byte flags) { }
public virtual void SendNameReply(LLUUID profileId, string firstname, string lastname){}
public void SendAlertMessage(string message) { }
@ -151,6 +156,8 @@ namespace OpenSim.Framework
{
return false;
}
public void SendViewerTime(int phase) { }
}
}

View File

@ -17,7 +17,7 @@ namespace OpenSim.Framework.Types
{
Same = 0,
Circle = 16,
Square =32,
Square = 32,
Triangle = 48
}
@ -122,7 +122,8 @@ namespace OpenSim.Framework.Types
public class GenericShape : PrimitiveBaseShape
{
public GenericShape() : base()
public GenericShape()
: base()
{
}
@ -133,7 +134,7 @@ namespace OpenSim.Framework.Types
public BoxShape()
: base()
{
PathCurve = (byte) Extrusion.Straight;
PathCurve = (byte)Extrusion.Straight;
ProfileShape = ProfileShape.Square;
PathScaleX = 100;
PathScaleY = 100;
@ -156,7 +157,7 @@ namespace OpenSim.Framework.Types
{
BoxShape boxShape = new BoxShape();
boxShape.SetSide( 0.5f );
boxShape.SetSide(0.5f);
return boxShape;
}
@ -187,7 +188,7 @@ namespace OpenSim.Framework.Types
private void SetRadius(float radius)
{
Scale.X = Scale.Y = radius*2f;
Scale.X = Scale.Y = radius * 2f;
}
}
}

View File

@ -114,7 +114,7 @@ namespace OpenSim.Grid.UserServer
}
#region XMLRPC User Methods
//should most likely move out of here and into the grid's userserver sub class
public XmlRpcResponse XmlRPCGetUserMethodName(XmlRpcRequest request)
{
XmlRpcResponse response = new XmlRpcResponse();

View File

@ -62,10 +62,8 @@ namespace OpenSim
ArgvConfigSource configSource = new ArgvConfigSource(args);
configSource.AddSwitch("Startup", "inifile");
configSource.AddSwitch("Startup", "configfile");
configSource.AddSwitch("Startup", "gridmode");
configSource.AddSwitch("Startup", "physics");
configSource.AddSwitch("Startup", "config");
configSource.AddSwitch("Startup", "noverbose");
OpenSimMain sim = new OpenSimMain(configSource);

View File

@ -340,6 +340,28 @@ namespace OpenSim
}
break;
case "save-xml":
if (cmdparams.Length > 0)
{
m_localScenes[0].SavePrimsToXml(cmdparams[0]);
}
else
{
m_localScenes[0].SavePrimsToXml("test.xml");
}
break;
case "load-xml":
if (cmdparams.Length > 0)
{
m_localScenes[0].LoadPrimsFromXml(cmdparams[0]);
}
else
{
m_localScenes[0].LoadPrimsFromXml("test.xml");
}
break;
case "terrain":
string result = "";
foreach (Scene scene in m_localScenes)
@ -357,7 +379,7 @@ namespace OpenSim
if (scene.RegionInfo.RegionName.ToLower() == cmdparams[0].ToLower())
{
string[] tmpCmdparams = new string[cmdparams.Length - 1];
cmdparams.CopyTo(tmpCmdparams,1);
cmdparams.CopyTo(tmpCmdparams, 1);
if (!scene.Terrain.RunTerrainCmd(tmpCmdparams, ref result2, scene.RegionInfo.RegionName))
{

View File

@ -88,6 +88,7 @@ namespace OpenSim.Region.ClientStack
public event RequestTaskInventory OnRequestTaskInventory;
public event UDPAssetUploadRequest OnAssetUploadRequest;
public event XferReceive OnXferReceive;
public event RequestXfer OnRequestXfer;
public event UUIDNameRequest OnNameFromUUIDRequest;
@ -542,21 +543,21 @@ namespace OpenSim.Region.ClientStack
descend.ItemData[i].CreatorID = item.creatorsID;
descend.ItemData[i].BaseMask = item.inventoryBasePermissions;
descend.ItemData[i].CreationDate = 1000;
descend.ItemData[i].Description = enc.GetBytes(item.inventoryDescription+ "\0");
descend.ItemData[i].Description = enc.GetBytes(item.inventoryDescription + "\0");
descend.ItemData[i].EveryoneMask = item.inventoryEveryOnePermissions;
descend.ItemData[i].Flags = 1;
descend.ItemData[i].FolderID = item.parentFolderID;
descend.ItemData[i].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000");
descend.ItemData[i].GroupMask = 0;
descend.ItemData[i].InvType = (sbyte)item.invType;
descend.ItemData[i].Name = enc.GetBytes(item.inventoryName+ "\0");
descend.ItemData[i].Name = enc.GetBytes(item.inventoryName + "\0");
descend.ItemData[i].NextOwnerMask = item.inventoryNextPermissions;
descend.ItemData[i].OwnerID = item.avatarID;
descend.ItemData[i].OwnerMask = item.inventoryCurrentPermissions;
descend.ItemData[i].SalePrice = 0;
descend.ItemData[i].SaleType = 0;
descend.ItemData[i].Type = (sbyte)item.assetType;
descend.ItemData[i].CRC = 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 = 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);
i++;
}
@ -617,14 +618,14 @@ namespace OpenSim.Region.ClientStack
InventoryReply.InventoryData[0].FolderID = Item.parentFolderID;
InventoryReply.InventoryData[0].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000");
InventoryReply.InventoryData[0].GroupMask = 0;
InventoryReply.InventoryData[0].InvType =(sbyte) Item.invType;
InventoryReply.InventoryData[0].InvType = (sbyte)Item.invType;
InventoryReply.InventoryData[0].Name = enc.GetBytes(Item.inventoryName + "\0");
InventoryReply.InventoryData[0].NextOwnerMask = Item.inventoryNextPermissions;
InventoryReply.InventoryData[0].OwnerID = Item.avatarID;
InventoryReply.InventoryData[0].OwnerMask = Item.inventoryCurrentPermissions;
InventoryReply.InventoryData[0].SalePrice = 100;
InventoryReply.InventoryData[0].SaleType = 0;
InventoryReply.InventoryData[0].Type =(sbyte) Item.assetType;
InventoryReply.InventoryData[0].Type = (sbyte)Item.assetType;
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);
@ -651,6 +652,15 @@ namespace OpenSim.Region.ClientStack
OutPacket(replytask);
}
public void SendXferPacket(ulong xferID, uint packet, byte[] data)
{
SendXferPacketPacket sendXfer = new SendXferPacketPacket();
sendXfer.XferID.ID = xferID;
sendXfer.XferID.Packet = packet;
sendXfer.DataPacket.Data = data;
OutPacket(sendXfer);
}
/// <summary>
///
/// </summary>
@ -689,6 +699,66 @@ namespace OpenSim.Region.ClientStack
OutPacket(loadURL);
}
public void SendPreLoadSound(LLUUID objectID, LLUUID ownerID, LLUUID soundID)
{
PreloadSoundPacket preSound = new PreloadSoundPacket();
preSound.DataBlock = new PreloadSoundPacket.DataBlockBlock[1];
preSound.DataBlock[0] = new PreloadSoundPacket.DataBlockBlock();
preSound.DataBlock[0].ObjectID = objectID;
preSound.DataBlock[0].OwnerID = ownerID;
preSound.DataBlock[0].SoundID = soundID;
OutPacket(preSound);
}
public void SendPlayAttachedSound(LLUUID soundID, LLUUID objectID, LLUUID ownerID, float gain, byte flags)
{
AttachedSoundPacket sound = new AttachedSoundPacket();
sound.DataBlock.SoundID = soundID;
sound.DataBlock.ObjectID = objectID;
sound.DataBlock.OwnerID = ownerID;
sound.DataBlock.Gain = gain;
sound.DataBlock.Flags = flags;
OutPacket(sound);
}
public void SendViewerTime(int phase)
{
SimulatorViewerTimeMessagePacket viewertime = new SimulatorViewerTimeMessagePacket();
//viewertime.TimeInfo.SecPerDay = 86400;
// viewertime.TimeInfo.SecPerYear = 31536000;
viewertime.TimeInfo.SecPerDay = 1000;
viewertime.TimeInfo.SecPerYear = 365000;
viewertime.TimeInfo.SunPhase = 1;
int sunPhase = (phase + 2) / 2;
if ((sunPhase < 12) || (sunPhase > 36))
{
viewertime.TimeInfo.SunDirection = new LLVector3(0f, 0.8f, -0.8f);
//Console.WriteLine("sending night");
}
else
{
sunPhase = sunPhase - 12;
float yValue = 0.1f * (sunPhase);
if (yValue > 1.2f) { yValue = yValue - 1.2f; }
if (yValue > 1 ) { yValue = 1; }
if (yValue < 0) { yValue = 0; }
if (sunPhase < 14)
{
yValue = 1 - yValue;
}
if (sunPhase < 12) { yValue *= -1; }
viewertime.TimeInfo.SunDirection = new LLVector3(0f, yValue, 0.3f);
//Console.WriteLine("sending sun update " + yValue);
}
viewertime.TimeInfo.SunAngVelocity = new LLVector3(0, 0.0f, 10.0f);
viewertime.TimeInfo.UsecSinceStart = (ulong)Util.UnixTimeSinceEpoch();
OutPacket(viewertime);
}
#endregion
#region Appearance/ Wearables Methods
@ -782,7 +852,7 @@ namespace OpenSim.Region.ClientStack
//give this avatar object a local id and assign the user a name
objupdate.ObjectData[0].ID = avatarLocalID;
objupdate.ObjectData[0].FullID = avatarID;
objupdate.ObjectData[0].NameValue = Helpers.StringToField("FirstName STRING RW SV " + firstName + "\nLastName STRING RW SV " + lastName );
objupdate.ObjectData[0].NameValue = Helpers.StringToField("FirstName STRING RW SV " + firstName + "\nLastName STRING RW SV " + lastName);
LLVector3 pos2 = new LLVector3((float)Pos.X, (float)Pos.Y, (float)Pos.Z);
byte[] pb = pos2.GetBytes();
Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 16, pb.Length);
@ -849,7 +919,7 @@ namespace OpenSim.Region.ClientStack
outPacket.ObjectData[0].ID = localID;
outPacket.ObjectData[0].FullID = objectID;
outPacket.ObjectData[0].OwnerID = ownerID;
outPacket.ObjectData[0].Text = Helpers.StringToField( text );
outPacket.ObjectData[0].Text = Helpers.StringToField(text);
outPacket.ObjectData[0].ParentID = parentID;
outPacket.ObjectData[0].PSBlock = particleSystem;
@ -1175,10 +1245,10 @@ namespace OpenSim.Region.ClientStack
packet.UUIDNameBlock = new UUIDNameReplyPacket.UUIDNameBlockBlock[1];
packet.UUIDNameBlock[0] = new UUIDNameReplyPacket.UUIDNameBlockBlock();
packet.UUIDNameBlock[0].ID = profileId;
packet.UUIDNameBlock[0].FirstName = Helpers.StringToField( firstname );
packet.UUIDNameBlock[0].LastName = Helpers.StringToField( lastname );
packet.UUIDNameBlock[0].FirstName = Helpers.StringToField(firstname);
packet.UUIDNameBlock[0].LastName = Helpers.StringToField(lastname);
OutPacket( packet );
OutPacket(packet);
}
#endregion

View File

@ -95,6 +95,22 @@ namespace OpenSim.Region.ClientStack
break;
#region Scene/Avatar
case PacketType.AvatarPropertiesRequest:
AvatarPropertiesRequestPacket avatarProperties = (AvatarPropertiesRequestPacket)Pack;
AvatarPropertiesReplyPacket avatarReply = new AvatarPropertiesReplyPacket();
avatarReply.AgentData.AgentID = this.AgentID;
avatarReply.AgentData.AvatarID = avatarProperties.AgentData.AvatarID;
avatarReply.PropertiesData.AboutText = Helpers.StringToField( "OpenSim crash test dummy");
avatarReply.PropertiesData.BornOn = Helpers.StringToField("Before now");
avatarReply.PropertiesData.CharterMember = new byte[0];
avatarReply.PropertiesData.FLAboutText = Helpers.StringToField("First life? What is one of those? OpenSim is my life!");
avatarReply.PropertiesData.Flags = 0;
avatarReply.PropertiesData.FLImageID = LLUUID.Zero;
avatarReply.PropertiesData.ImageID = LLUUID.Zero;
avatarReply.PropertiesData.ProfileURL = new byte[0];
avatarReply.PropertiesData.PartnerID = new LLUUID("11111111-1111-0000-0000-000100bba000");
OutPacket(avatarReply);
break;
case PacketType.ChatFromViewer:
ChatFromViewerPacket inchatpack = (ChatFromViewerPacket)Pack;
if (Util.FieldToString(inchatpack.ChatData.Message) == "")
@ -366,7 +382,11 @@ namespace OpenSim.Region.ClientStack
}
break;
case PacketType.RequestXfer:
//Console.WriteLine(Pack.ToString());
RequestXferPacket xferReq = (RequestXferPacket)Pack;
if (OnRequestXfer != null)
{
OnRequestXfer(this, xferReq.XferID.ID, Util.FieldToString(xferReq.XferID.Filename));
}
break;
case PacketType.SendXferPacket:
SendXferPacketPacket xferRec = (SendXferPacketPacket)Pack;

View File

@ -472,7 +472,7 @@ namespace OpenSim.Region.Environment.Scenes
hasPrim = ((SceneObjectGroup)ent).HasChildPrim(primLocalID);
if (hasPrim != false)
{
((SceneObjectGroup)ent).GetPartInventory(remoteClient, primLocalID);
((SceneObjectGroup)ent).GetPartInventoryFileName(remoteClient, primLocalID);
break;
}
}
@ -757,6 +757,25 @@ namespace OpenSim.Region.Environment.Scenes
}
}
/// <summary>
///
/// </summary>
/// <param name="remoteClient"></param>
/// <param name="xferID"></param>
/// <param name="fileName"></param>
public void RequestXfer(IClientAPI remoteClient, ulong xferID, string fileName)
{
/*
foreach (EntityBase ent in Entities.Values)
{
if (ent is SceneObjectGroup)
{
((SceneObjectGroup)ent).RequestInventoryFile(remoteClient, ((SceneObjectGroup)ent).LocalId, xferID);
break;
}
}*/
}
/// <summary>
/// temporary method to test out creating new inventory items
/// </summary>

View File

@ -29,6 +29,8 @@ using System;
using System.Collections.Generic;
using System.Threading;
using System.Timers;
using System.IO;
using System.Xml;
using libsecondlife;
using OpenSim.Framework;
using OpenSim.Framework.Communications;
@ -65,6 +67,10 @@ namespace OpenSim.Region.Environment.Scenes
private int storageCount;
private int terrainCheckCount;
private int landPrimCheckCount;
private int m_timePhase = 24;
private int m_timeUpdateCount;
private Mutex updateLock;
protected StorageManager storageManager;
@ -123,6 +129,11 @@ namespace OpenSim.Region.Environment.Scenes
get { return Prims; }
}
public int TimePhase
{
get { return this.m_timePhase; }
}
#endregion
#region Constructors
@ -301,6 +312,26 @@ namespace OpenSim.Region.Environment.Scenes
landPrimCheckCount = 0;
}
}
m_timeUpdateCount++;
if (m_timeUpdateCount > 600)
{
List<ScenePresence> Avatars = this.RequestAvatarList();
foreach (ScenePresence avatar in Avatars)
{
if (!avatar.childAgent)
{
//Console.WriteLine("sending time update " + timePhase + " from region " + m_regionHandle + " to avatar " + avatar.Firstname);
avatar.ControllingClient.SendViewerTime(m_timePhase);
}
}
m_timeUpdateCount = 0;
m_timePhase++;
if (m_timePhase > 94)
{
m_timePhase = 0;
}
}
}
catch (NotImplementedException)
{
@ -538,7 +569,7 @@ namespace OpenSim.Region.Environment.Scenes
public void AddEntity(SceneObjectGroup sceneObject)
{
if(!Entities.ContainsKey(sceneObject.UUID))
if (!Entities.ContainsKey(sceneObject.UUID))
{
Entities.Add(sceneObject.UUID, sceneObject);
}
@ -563,6 +594,52 @@ namespace OpenSim.Region.Environment.Scenes
prim.OnPrimCountTainted += m_LandManager.setPrimsTainted;
}
public void LoadPrimsFromXml(string fileName)
{
XmlDocument doc = new XmlDocument();
XmlNode rootNode;
int primCount = 0;
if (File.Exists(fileName))
{
XmlTextReader reader = new XmlTextReader(fileName);
reader.WhitespaceHandling = WhitespaceHandling.None;
doc.Load(reader);
reader.Close();
rootNode = doc.FirstChild;
foreach (XmlNode aPrimNode in rootNode.ChildNodes)
{
SceneObjectGroup obj = new SceneObjectGroup(this,
this.m_regionHandle, aPrimNode.OuterXml);
AddEntity(obj);
primCount++;
}
}
else
{
throw new Exception("Could not open file " + fileName + " for reading");
}
}
public void SavePrimsToXml(string fileName)
{
FileStream file = new FileStream(fileName, FileMode.Create);
StreamWriter stream = new StreamWriter(file);
int primCount = 0;
stream.WriteLine("<scene>\n");
foreach (EntityBase ent in Entities.Values)
{
if (ent is SceneObjectGroup)
{
stream.WriteLine(((SceneObjectGroup)ent).ToXmlString());
primCount++;
}
}
stream.WriteLine("</scene>\n");
stream.Close();
file.Close();
}
#endregion
#region Add/Remove Avatar Methods
@ -632,6 +709,7 @@ namespace OpenSim.Region.Environment.Scenes
client.OnFetchInventory += commsManager.UserProfiles.HandleFetchInventory;
client.OnAssetUploadRequest += commsManager.TransactionsManager.HandleUDPUploadRequest;
client.OnXferReceive += commsManager.TransactionsManager.HandleXfer;
// client.OnRequestXfer += RequestXfer;
client.OnGrabObject += ProcessObjectGrab;
}
@ -950,7 +1028,7 @@ namespace OpenSim.Region.Environment.Scenes
AgentCircuitData agent = remoteClient.RequestClientInfo();
agent.BaseFolder = LLUUID.Zero;
agent.InventoryFolder = LLUUID.Zero;
// agent.startpos = new LLVector3(128, 128, 70);
// agent.startpos = new LLVector3(128, 128, 70);
agent.startpos = position;
agent.child = true;
commsManager.InterRegion.InformRegionOfChildAgent(regionHandle, agent);
@ -1122,6 +1200,14 @@ namespace OpenSim.Region.Environment.Scenes
userInfo.UpdateItem(remoteClient.AgentId, item);
// remoteClient.SendInventoryItemUpdate(item);
if (item.invType == 7)
{
//do we want to know about updated note cards?
}
else if (item.invType == 10)
{
// do we want to know about updated scripts
}
return (asset.FullID);
}

View File

@ -212,7 +212,6 @@ namespace OpenSim.Region.Environment.Scenes
public string ToXmlString()
{
StringWriter sw = new StringWriter();
//StreamWriter st = new StreamWriter("testxml.txt");
XmlTextWriter writer = new XmlTextWriter(sw);
writer.WriteStartElement(String.Empty, "SceneObjectGroup", String.Empty);
writer.WriteStartElement(String.Empty, "RootPart", String.Empty);
@ -231,11 +230,7 @@ namespace OpenSim.Region.Environment.Scenes
writer.WriteEndElement();
writer.WriteEndElement();
writer.Close();
// System.Console.WriteLine("prim: " + sw.ToString());
return sw.ToString();
// st.Close();
// return "";
}
#region Copying
@ -557,12 +552,26 @@ namespace OpenSim.Region.Environment.Scenes
/// </summary>
/// <param name="remoteClient"></param>
/// <param name="localID"></param>
public void GetPartInventory(IClientAPI remoteClient, uint localID)
public void GetPartInventoryFileName(IClientAPI remoteClient, uint localID)
{
SceneObjectPart part = this.GetChildPrim(localID);
if (part != null)
{
part.GetInventory(remoteClient, localID);
part.GetInventoryFileName(remoteClient, localID);
}
}
/// <summary>
///
/// </summary>
/// <param name="remoteClient"></param>
/// <param name="partID"></param>
public void RequestInventoryFile(IClientAPI remoteClient, uint localID, ulong xferID)
{
SceneObjectPart part = this.GetChildPrim(localID);
if (part != null)
{
part.RequestInventoryFile(remoteClient, xferID);
}
}
@ -636,6 +645,7 @@ namespace OpenSim.Region.Environment.Scenes
public void UpdateGroupPosition(LLVector3 pos)
{
this.AbsolutePosition = pos;
}
/// <summary>

View File

@ -47,7 +47,7 @@ namespace OpenSim.Region.Environment.Scenes
public LLUUID UUID
{
get { return m_uuid; }
set { m_uuid = value ; }
set { m_uuid = value; }
}
protected uint m_localID;
@ -64,7 +64,7 @@ namespace OpenSim.Region.Environment.Scenes
set { m_name = value; }
}
protected LLObject.ObjectFlags m_flags = (LLObject.ObjectFlags)32 + 65536 + 131072 + 256 + 4 + 8 + 2048 + 524288 + 268435456 + 128;
protected LLObject.ObjectFlags m_flags = (LLObject.ObjectFlags)32 + 65536 + 131072 + 256 + 4 + 8 + 268435456 + 128;
public uint ObjectFlags
{
get { return (uint)m_flags; }
@ -222,7 +222,6 @@ namespace OpenSim.Region.Environment.Scenes
this.Acceleration = new LLVector3(0, 0, 0);
//temporary code just so the m_flags field doesn't give a compiler warning
if (m_flags == LLObject.ObjectFlags.AllowInventoryDrop)
{
@ -233,6 +232,7 @@ namespace OpenSim.Region.Environment.Scenes
/// <summary>
/// Re/create a SceneObjectPart (prim)
/// currently not used, and maybe won't be
/// </summary>
/// <param name="regionHandle"></param>
/// <param name="parent"></param>
@ -396,13 +396,59 @@ namespace OpenSim.Region.Environment.Scenes
#endregion
#region Inventory
public void GetInventory(IClientAPI client, uint localID)
/// <summary>
///
/// </summary>
/// <param name="client"></param>
/// <param name="localID"></param>
public void GetInventoryFileName(IClientAPI client, uint localID)
{
if (localID == this.m_localID)
{
// client.SendTaskInventory(this.m_uuid, 0, Helpers.StringToField("primInventory"));
client.SendTaskInventory(this.m_uuid, 0, new byte[0]);
}
}
/// <summary>
///
/// </summary>
/// <param name="client"></param>
/// <param name="xferID"></param>
public void RequestInventoryFile(IClientAPI client, ulong xferID)
{
// a test item
InventoryStringBuilder invString = new InventoryStringBuilder();
invString.AddItemStart();
invString.AddNameValueLine("item_id", LLUUID.Random().ToStringHyphenated());
invString.AddNameValueLine("parent_id", this.UUID.ToStringHyphenated());
invString.AddPermissionsStart();
invString.AddNameValueLine("base_mask", "0x7FFFFFFF");
invString.AddNameValueLine("owner_mask", "0x7FFFFFFF");
invString.AddNameValueLine("group_mask", "0x7FFFFFFF");
invString.AddNameValueLine("everyone_mask", "0x7FFFFFFF");
invString.AddNameValueLine("next_owner_mask", "0x7FFFFFFF");
invString.AddNameValueLine("creator_id", client.AgentId.ToStringHyphenated());
invString.AddNameValueLine("owner_id", client.AgentId.ToStringHyphenated());
invString.AddNameValueLine("last_owner_id", LLUUID.Zero.ToStringHyphenated());
invString.AddNameValueLine("group_id", LLUUID.Zero.ToStringHyphenated());
invString.AddSectionEnd();
invString.AddNameValueLine("asset_id", "00000000-0000-0000-9999-000000000002");
invString.AddNameValueLine("type", "texture");
invString.AddNameValueLine("inv_type" , "texture");
invString.AddNameValueLine("flags", "0x00");
invString.AddNameValueLine("name", "Test inventory" + "|");
invString.AddNameValueLine("desc", "test description" + "|");
invString.AddNameValueLine("creation_date", "10000");
invString.AddSectionEnd();
byte[] fileInv = Helpers.StringToField(invString.BuildString);
byte[] data = new byte[fileInv.Length + 4];
Array.Copy(fileInv, 0,data , 4, fileInv.Length);
client.SendXferPacket(xferID, 0 + 0x80000000, data);
}
#endregion
#region ExtraParams
@ -497,7 +543,7 @@ namespace OpenSim.Region.Environment.Scenes
/// <param name="remoteClient"></param>
public void SendFullUpdate(IClientAPI remoteClient)
{
m_parentGroup.SendPartFullUpdate( remoteClient, this );
m_parentGroup.SendPartFullUpdate(remoteClient, this);
}
/// <summary>
@ -582,6 +628,45 @@ namespace OpenSim.Region.Environment.Scenes
{
Text = text;
}
public class InventoryStringBuilder
{
public string BuildString = "";
public InventoryStringBuilder()
{
}
public void AddItemStart()
{
BuildString += "\tinv_item\t0\n";
BuildString += "\t{\n";
}
public void AddPermissionsStart()
{
BuildString += "\tpermissions 0\n";
BuildString += "\t{\n";
}
public void AddSectionEnd()
{
BuildString += "\t}\n";
}
public void AddLine(string addLine)
{
BuildString += addLine;
}
public void AddNameValueLine(string name, string value)
{
BuildString += "\t\t";
BuildString += name + "\t";
BuildString += value + "\n";
}
}
}
}

View File

@ -59,7 +59,7 @@ namespace OpenSim.Region.Environment.Scenes
private ulong m_regionHandle;
public bool childAgent = false;
public bool childAgent = true;
public bool IsRestrictedToRegion = false;
private bool newForce = false;
@ -495,6 +495,7 @@ namespace OpenSim.Region.Environment.Scenes
this.SendArrearanceToAllOtherAgents();
this.m_scene.SendAllSceneObjectsToClient(this.ControllingClient);
this.ControllingClient.SendViewerTime(this.m_scene.TimePhase);
}
/// <summary>

View File

@ -73,6 +73,7 @@ namespace SimpleApp
public event RequestTaskInventory OnRequestTaskInventory;
public event UDPAssetUploadRequest OnAssetUploadRequest;
public event XferReceive OnXferReceive;
public event RequestXfer OnRequestXfer;
public event UUIDNameRequest OnNameFromUUIDRequest;
@ -155,8 +156,13 @@ namespace SimpleApp
public virtual void SendInventoryItemUpdate(InventoryItemBase Item) { }
public virtual void SendRemoveInventoryItem(LLUUID itemID) { }
public virtual void SendTaskInventory(LLUUID taskID, short serial, byte[] fileName) { }
public virtual void SendXferPacket(ulong xferID, uint packet, byte[] data) { }
public virtual void SendNameReply(LLUUID profileId, string firstname, string lastname) { }
public virtual void SendPreLoadSound(LLUUID objectID, LLUUID ownerID, LLUUID soundID) { }
public virtual void SendPlayAttachedSound(LLUUID soundID, LLUUID objectID, LLUUID ownerID, float gain, byte flags) { }
public void SendAlertMessage(string message) { }
public void SendAgentAlertMessage(string message, bool modal) { }
public void SendLoadURL(string objectname, LLUUID objectID, LLUUID ownerID, bool groupOwned, string message, string url) { }
@ -208,5 +214,7 @@ namespace SimpleApp
{
return false;
}
public void SendViewerTime(int phase) { }
}
}

View File

@ -1,6 +1,9 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Xml;
using System.Xml.Serialization;
using System.IO;
using OpenSim.Region.Environment.Scenes;
using OpenSim.Region.Environment.LandManagement;
@ -182,7 +185,8 @@ namespace OpenSim.DataStore.MonoSqliteStorage
// this provides the binding for all our parameters, so
// much less code than it used to be
foreach (KeyValuePair<string, DbType> kvp in defs) {
foreach (KeyValuePair<string, DbType> kvp in defs)
{
cmd.Parameters.Add(createSqliteParameter(kvp.Key, kvp.Value));
}
return cmd;
@ -192,8 +196,10 @@ namespace OpenSim.DataStore.MonoSqliteStorage
{
string sql = "update " + table + " set ";
string subsql = "";
foreach (string key in defs.Keys) {
if (subsql.Length > 0) { // a map function would rock so much here
foreach (string key in defs.Keys)
{
if (subsql.Length > 0)
{ // a map function would rock so much here
subsql += ", ";
}
subsql += key + "= :" + key;
@ -204,7 +210,8 @@ namespace OpenSim.DataStore.MonoSqliteStorage
// this provides the binding for all our parameters, so
// much less code than it used to be
foreach (KeyValuePair<string, DbType> kvp in defs) {
foreach (KeyValuePair<string, DbType> kvp in defs)
{
cmd.Parameters.Add(createSqliteParameter(kvp.Key, kvp.Value));
}
return cmd;
@ -384,10 +391,21 @@ namespace OpenSim.DataStore.MonoSqliteStorage
// way to specify this as a blob atm
// s.TextureEntry = (byte[])row["Texture"];
//following hack will only save the default face texture, any other textures on other faces
//won't be saved or restored.
LLObject.TextureEntry texture = new LLObject.TextureEntry( new LLUUID((string)row["Texture"]));
s.TextureEntry = texture.ToBytes();
string texture = (string)row["Texture"];
if (!texture.StartsWith("<"))
{
//here so that we can still work with old format database files (ie from before I added xml serialization)
LLObject.TextureEntry textureEntry = null;
textureEntry = new LLObject.TextureEntry(new LLUUID(texture));
s.TextureEntry = textureEntry.ToBytes();
}
else
{
TextureBlock textureEntry = TextureBlock.FromXmlString(texture);
s.TextureEntry = textureEntry.TextureData;
s.ExtraParams = textureEntry.ExtraParams;
}
return s;
}
@ -428,12 +446,13 @@ namespace OpenSim.DataStore.MonoSqliteStorage
// And I couldn't work out how to save binary data either
// seems that the texture colum is being treated as a string in the Datarow
// if you do a .getType() on it, it returns string, while the other columns return correct type
//following hack will only save the default face texture, any other textures on other faces
//won't be saved or restored.
// MW[10-08-07]
LLObject.TextureEntry text = new LLObject.TextureEntry(s.TextureEntry, 0, s.TextureEntry.Length);
row["Texture"] = text.DefaultTexture.TextureID.ToStringHyphenated();
// Added following xml hack but not really ideal , also ExtraParams isn't currently part of the database
// am a bit worried about adding it now as some people will have old format databases, so for now including that data in this xml data
// MW[17-08-07]
TextureBlock textureBlock = new TextureBlock(s.TextureEntry);
textureBlock.ExtraParams = s.ExtraParams;
row["Texture"] = textureBlock.ToXMLString();
}
private void addPrim(SceneObjectPart prim, LLUUID sceneGroupID)
@ -442,20 +461,26 @@ namespace OpenSim.DataStore.MonoSqliteStorage
DataTable shapes = ds.Tables["primshapes"];
DataRow primRow = prims.Rows.Find(prim.UUID);
if (primRow == null) {
if (primRow == null)
{
primRow = prims.NewRow();
fillPrimRow(primRow, prim, sceneGroupID);
prims.Rows.Add(primRow);
} else {
}
else
{
fillPrimRow(primRow, prim, sceneGroupID);
}
DataRow shapeRow = shapes.Rows.Find(prim.UUID);
if (shapeRow == null) {
if (shapeRow == null)
{
shapeRow = shapes.NewRow();
fillShapeRow(shapeRow, prim);
shapes.Rows.Add(shapeRow);
} else {
}
else
{
fillShapeRow(shapeRow, prim);
}
}
@ -578,5 +603,42 @@ namespace OpenSim.DataStore.MonoSqliteStorage
{
// TODO: DataSet commit
}
public class TextureBlock
{
public byte[] TextureData;
public byte[] ExtraParams = new byte[1];
public TextureBlock(byte[] data)
{
TextureData = data;
}
public TextureBlock()
{
}
public string ToXMLString()
{
StringWriter sw = new StringWriter();
XmlTextWriter writer = new XmlTextWriter(sw);
XmlSerializer serializer = new XmlSerializer(typeof(TextureBlock));
serializer.Serialize(writer, this);
return sw.ToString();
}
public static TextureBlock FromXmlString(string xmlData)
{
TextureBlock textureEntry = null;
StringReader sr = new StringReader(xmlData);
XmlTextReader reader = new XmlTextReader(sr);
XmlSerializer serializer = new XmlSerializer(typeof(TextureBlock));
textureEntry = (TextureBlock)serializer.Deserialize(reader);
reader.Close();
sr.Close();
return textureEntry;
}
}
}
}