* Mergin, mergin. Keep ooon mergin!
parent
1e2e583f8e
commit
03dbce1b42
|
@ -49,6 +49,7 @@ namespace OpenSim.Framework
|
||||||
InventoryFolder = new LLUUID(cAgent.InventoryFolder);
|
InventoryFolder = new LLUUID(cAgent.InventoryFolder);
|
||||||
BaseFolder = new LLUUID(cAgent.BaseFolder);
|
BaseFolder = new LLUUID(cAgent.BaseFolder);
|
||||||
CapsPath = cAgent.CapsPath;
|
CapsPath = cAgent.CapsPath;
|
||||||
|
ClientVersion = cAgent.ClientVersion; //rex
|
||||||
}
|
}
|
||||||
|
|
||||||
public LLUUID AgentID;
|
public LLUUID AgentID;
|
||||||
|
@ -62,6 +63,9 @@ namespace OpenSim.Framework
|
||||||
public LLUUID InventoryFolder;
|
public LLUUID InventoryFolder;
|
||||||
public LLUUID BaseFolder;
|
public LLUUID BaseFolder;
|
||||||
public string CapsPath = "";
|
public string CapsPath = "";
|
||||||
|
public string ClientVersion = "not set"; //rex
|
||||||
|
public string authenticationAddr;
|
||||||
|
public string asAddress = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
[Serializable]
|
[Serializable]
|
||||||
|
@ -86,6 +90,7 @@ namespace OpenSim.Framework
|
||||||
InventoryFolder = cAgent.InventoryFolder.UUID;
|
InventoryFolder = cAgent.InventoryFolder.UUID;
|
||||||
BaseFolder = cAgent.BaseFolder.UUID;
|
BaseFolder = cAgent.BaseFolder.UUID;
|
||||||
CapsPath = cAgent.CapsPath;
|
CapsPath = cAgent.CapsPath;
|
||||||
|
ClientVersion = cAgent.ClientVersion; //rex
|
||||||
}
|
}
|
||||||
|
|
||||||
public Guid AgentID;
|
public Guid AgentID;
|
||||||
|
@ -101,5 +106,6 @@ namespace OpenSim.Framework
|
||||||
public Guid InventoryFolder;
|
public Guid InventoryFolder;
|
||||||
public Guid BaseFolder;
|
public Guid BaseFolder;
|
||||||
public string CapsPath = "";
|
public string CapsPath = "";
|
||||||
|
public string ClientVersion = "not set"; //rex
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -64,6 +64,7 @@ namespace OpenSim.Framework
|
||||||
user.LoginInfo.Last = validcircuit.lastname;
|
user.LoginInfo.Last = validcircuit.lastname;
|
||||||
user.LoginInfo.InventoryFolder = validcircuit.InventoryFolder;
|
user.LoginInfo.InventoryFolder = validcircuit.InventoryFolder;
|
||||||
user.LoginInfo.BaseFolder = validcircuit.BaseFolder;
|
user.LoginInfo.BaseFolder = validcircuit.BaseFolder;
|
||||||
|
user.LoginInfo.ClientVersion = validcircuit.ClientVersion;//rex
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -39,6 +39,7 @@ namespace OpenSim.Framework
|
||||||
public sbyte InvType;
|
public sbyte InvType;
|
||||||
public string Name = "";
|
public string Name = "";
|
||||||
public string Description = "";
|
public string Description = "";
|
||||||
|
public string MediaURL = "";//rex
|
||||||
public bool Local = false;
|
public bool Local = false;
|
||||||
public bool Temporary = false;
|
public bool Temporary = false;
|
||||||
|
|
||||||
|
|
|
@ -44,6 +44,7 @@ namespace OpenSim.Framework
|
||||||
InvType = a.InvType;
|
InvType = a.InvType;
|
||||||
Name = a.Name;
|
Name = a.Name;
|
||||||
Description = a.Description;
|
Description = a.Description;
|
||||||
|
MediaURL = a.MediaURL; //rex
|
||||||
InternData();
|
InternData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -202,6 +202,18 @@ namespace OpenSim.Framework.Communications.Cache
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// rex, new function
|
||||||
|
public List<AssetBase> GetAssetList(int vAssetType)
|
||||||
|
{
|
||||||
|
return m_assetServer.GetAssetList(vAssetType);
|
||||||
|
}
|
||||||
|
|
||||||
|
// rex, new function
|
||||||
|
public AssetBase FetchAsset(LLUUID assetID)
|
||||||
|
{
|
||||||
|
return m_assetServer.FetchAsset(assetID);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Add an asset to both the persistent store and the cache.
|
/// Add an asset to both the persistent store and the cache.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -259,6 +271,106 @@ namespace OpenSim.Framework.Communications.Cache
|
||||||
m_log.Verbose("ASSETCACHE", "Adding {0} {1} [{2}]: {3}.", temporary, type, asset.FullID, result);
|
m_log.Verbose("ASSETCACHE", "Adding {0} {1} [{2}]: {3}.", temporary, type, asset.FullID, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// rex, new function for "replace asset" functionality
|
||||||
|
public void ReplaceAsset(AssetBase asset)
|
||||||
|
{
|
||||||
|
string temporary = asset.Temporary ? "temporary" : "";
|
||||||
|
string type = asset.Type == 0 ? "texture" : "asset";
|
||||||
|
|
||||||
|
string result = "Ignored";
|
||||||
|
|
||||||
|
if (asset.Type == 0)
|
||||||
|
{
|
||||||
|
if (Textures.ContainsKey(asset.FullID))
|
||||||
|
{
|
||||||
|
Textures.Remove(asset.FullID);
|
||||||
|
}
|
||||||
|
|
||||||
|
TextureImage textur = new TextureImage(asset);
|
||||||
|
Textures.Add(textur.FullID, textur);
|
||||||
|
|
||||||
|
if (asset.Temporary)
|
||||||
|
{
|
||||||
|
result = "Replaced old asset in cache";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_assetServer.UpdateAsset(asset);
|
||||||
|
result = "Replaced old asset on server";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (Assets.ContainsKey(asset.FullID))
|
||||||
|
{
|
||||||
|
Assets.Remove(asset.FullID);
|
||||||
|
}
|
||||||
|
|
||||||
|
AssetInfo assetInf = new AssetInfo(asset);
|
||||||
|
Assets.Add(assetInf.FullID, assetInf);
|
||||||
|
|
||||||
|
if (asset.Temporary)
|
||||||
|
{
|
||||||
|
result = "Replaced old asset in cache";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_assetServer.UpdateAsset(asset);
|
||||||
|
result = "Replaced old asset on server";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
m_log.Verbose("ASSETCACHE", "Adding {0} {1} [{2}]: {3}.", temporary, type, asset.FullID, result);
|
||||||
|
}
|
||||||
|
|
||||||
|
// rex new function
|
||||||
|
public bool ExistsAsset(LLUUID assetID)
|
||||||
|
{
|
||||||
|
if (Textures.ContainsKey(assetID))
|
||||||
|
return true;
|
||||||
|
if (Assets.ContainsKey(assetID))
|
||||||
|
return true;
|
||||||
|
return m_assetServer.ExistsAsset(assetID);
|
||||||
|
}
|
||||||
|
|
||||||
|
// rex new function for "replace asset" functionality
|
||||||
|
public LLUUID ExistsAsset(sbyte type, string name)
|
||||||
|
{
|
||||||
|
// First check locally cached assets
|
||||||
|
// Texture or other asset?
|
||||||
|
if (type == 0)
|
||||||
|
{
|
||||||
|
foreach (KeyValuePair<LLUUID, TextureImage> kvp in Textures)
|
||||||
|
{
|
||||||
|
TextureImage t = kvp.Value;
|
||||||
|
if (t != null)
|
||||||
|
{
|
||||||
|
if ((t.Name == name) && (t.Type == type))
|
||||||
|
{
|
||||||
|
return t.FullID;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
foreach (KeyValuePair<LLUUID, AssetInfo> kvp in Assets)
|
||||||
|
{
|
||||||
|
AssetInfo a = kvp.Value;
|
||||||
|
if (a != null)
|
||||||
|
{
|
||||||
|
if ((a.Name == name) && (a.Type == type))
|
||||||
|
{
|
||||||
|
return a.FullID;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Then have to check asset server
|
||||||
|
return m_assetServer.ExistsAsset(type, name);
|
||||||
|
}
|
||||||
|
|
||||||
public void DeleteAsset(LLUUID assetID)
|
public void DeleteAsset(LLUUID assetID)
|
||||||
{
|
{
|
||||||
// this.m_assetServer.DeleteAsset(assetID);
|
// this.m_assetServer.DeleteAsset(assetID);
|
||||||
|
@ -564,6 +676,7 @@ namespace OpenSim.Framework.Communications.Cache
|
||||||
InvType = aBase.InvType;
|
InvType = aBase.InvType;
|
||||||
Name = aBase.Name;
|
Name = aBase.Name;
|
||||||
Description = aBase.Description;
|
Description = aBase.Description;
|
||||||
|
MediaURL = aBase.MediaURL; //rex
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -581,6 +694,7 @@ namespace OpenSim.Framework.Communications.Cache
|
||||||
InvType = aBase.InvType;
|
InvType = aBase.InvType;
|
||||||
Name = aBase.Name;
|
Name = aBase.Name;
|
||||||
Description = aBase.Description;
|
Description = aBase.Description;
|
||||||
|
MediaURL = aBase.MediaURL; //rex
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -72,6 +72,60 @@ namespace OpenSim.Framework.Communications.Cache
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// rex new function for "replace assets" functionality
|
||||||
|
public override LLUUID ExistsAsset(sbyte assetType, string name)
|
||||||
|
{
|
||||||
|
IObjectSet result = db.Query(new AssetTypeNameQuery(assetType, name));
|
||||||
|
AssetStorage foundAsset = null;
|
||||||
|
if (result.Count > 0)
|
||||||
|
{
|
||||||
|
foundAsset = (AssetStorage)result.Next();
|
||||||
|
return foundAsset.UUID;
|
||||||
|
}
|
||||||
|
return LLUUID.Zero;
|
||||||
|
}
|
||||||
|
|
||||||
|
// rex new function
|
||||||
|
public override bool ExistsAsset(LLUUID assetID)
|
||||||
|
{
|
||||||
|
IObjectSet result = db.Query(new AssetUUIDQuery(assetID));
|
||||||
|
if (result.Count > 0)
|
||||||
|
return true;
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// rex new function
|
||||||
|
public override AssetBase FetchAsset(LLUUID assetID)
|
||||||
|
{
|
||||||
|
byte[] idata = null;
|
||||||
|
bool found = false;
|
||||||
|
AssetStorage foundAsset = null;
|
||||||
|
IObjectSet result = db.Query(new AssetUUIDQuery(assetID));
|
||||||
|
if (result.Count > 0)
|
||||||
|
{
|
||||||
|
foundAsset = (AssetStorage)result.Next();
|
||||||
|
found = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
AssetBase asset = new AssetBase();
|
||||||
|
if (found)
|
||||||
|
{
|
||||||
|
asset.FullID = foundAsset.UUID;
|
||||||
|
asset.Type = foundAsset.Type;
|
||||||
|
asset.InvType = foundAsset.Type;
|
||||||
|
asset.Name = foundAsset.Name;
|
||||||
|
idata = foundAsset.Data;
|
||||||
|
asset.Data = idata;
|
||||||
|
|
||||||
|
return asset;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected override AssetBase GetAsset(AssetRequest req)
|
protected override AssetBase GetAsset(AssetRequest req)
|
||||||
{
|
{
|
||||||
byte[] idata = null;
|
byte[] idata = null;
|
||||||
|
@ -113,6 +167,25 @@ namespace OpenSim.Framework.Communications.Cache
|
||||||
CommitAssets();
|
CommitAssets();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// rex overrided function for "replace assets" functionality to work with local assetserver
|
||||||
|
public override void UpdateAsset(AssetBase asset)
|
||||||
|
{
|
||||||
|
lock (m_syncLock)
|
||||||
|
{
|
||||||
|
IObjectSet result = db.Query(new AssetUUIDQuery(asset.FullID));
|
||||||
|
AssetStorage foundAsset = null;
|
||||||
|
|
||||||
|
int i;
|
||||||
|
for (i = 0; i < result.Count; i++)
|
||||||
|
{
|
||||||
|
foundAsset = (AssetStorage)result.Next();
|
||||||
|
db.Delete(foundAsset);
|
||||||
|
}
|
||||||
|
|
||||||
|
StoreAsset(asset);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected override void CommitAssets()
|
protected override void CommitAssets()
|
||||||
{
|
{
|
||||||
db.Commit();
|
db.Commit();
|
||||||
|
@ -140,4 +213,22 @@ namespace OpenSim.Framework.Communications.Cache
|
||||||
return (asset.UUID == _findID);
|
return (asset.UUID == _findID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// rex new class for "replace assets" functionality
|
||||||
|
public class AssetTypeNameQuery : Predicate
|
||||||
|
{
|
||||||
|
private sbyte _findType;
|
||||||
|
private string _findName;
|
||||||
|
|
||||||
|
public AssetTypeNameQuery(sbyte type, string name)
|
||||||
|
{
|
||||||
|
_findType = type;
|
||||||
|
_findName = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Match(AssetStorage asset)
|
||||||
|
{
|
||||||
|
return ((asset.Type == _findType) && (asset.Name == _findName));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -49,6 +49,8 @@ namespace OpenSim.Framework.Communications.Cache
|
||||||
protected abstract void StoreAsset(AssetBase asset);
|
protected abstract void StoreAsset(AssetBase asset);
|
||||||
protected abstract void CommitAssets();
|
protected abstract void CommitAssets();
|
||||||
|
|
||||||
|
public abstract LLUUID ExistsAsset(sbyte assetType, string name); // rex new function for "replace assets" functionality
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// This method must be implemented by a subclass to retrieve the asset named in the
|
/// This method must be implemented by a subclass to retrieve the asset named in the
|
||||||
/// AssetRequest. If the asset is not found, null should be returned.
|
/// AssetRequest. If the asset is not found, null should be returned.
|
||||||
|
@ -68,8 +70,8 @@ namespace OpenSim.Framework.Communications.Cache
|
||||||
|
|
||||||
if (asset != null)
|
if (asset != null)
|
||||||
{
|
{
|
||||||
//MainLog.Instance.Verbose(
|
MainLog.Instance.Verbose(
|
||||||
// "ASSET", "Asset {0} received from asset server", req.AssetID);
|
"ASSET", "Asset {0} received from asset server", req.AssetID);
|
||||||
|
|
||||||
m_receiver.AssetReceived(asset, req.IsTexture);
|
m_receiver.AssetReceived(asset, req.IsTexture);
|
||||||
}
|
}
|
||||||
|
@ -152,6 +154,33 @@ namespace OpenSim.Framework.Communications.Cache
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// rex, new function
|
||||||
|
public List<AssetBase> GetAssetList(int vAssetType)
|
||||||
|
{
|
||||||
|
lock (m_syncLock)
|
||||||
|
{
|
||||||
|
return m_assetProvider.GetAssetList(vAssetType);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// rex, new function
|
||||||
|
public virtual AssetBase FetchAsset(LLUUID assetID)
|
||||||
|
{
|
||||||
|
lock (m_syncLock)
|
||||||
|
{
|
||||||
|
return m_assetProvider.FetchAsset(assetID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// rex, new function
|
||||||
|
public virtual bool ExistsAsset(LLUUID assetID)
|
||||||
|
{
|
||||||
|
lock (m_syncLock)
|
||||||
|
{
|
||||||
|
return m_assetProvider.ExistsAsset(assetID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public virtual void Close()
|
public virtual void Close()
|
||||||
{
|
{
|
||||||
m_localAssetServerThread.Abort();
|
m_localAssetServerThread.Abort();
|
||||||
|
|
|
@ -116,6 +116,13 @@ namespace OpenSim.Framework.Communications.Cache
|
||||||
throw new Exception("The method or operation is not implemented.");
|
throw new Exception("The method or operation is not implemented.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// rex new function for "replace assets" functionality
|
||||||
|
// TODO: implementation by someone
|
||||||
|
public override libsecondlife.LLUUID ExistsAsset(sbyte assetType, string name)
|
||||||
|
{
|
||||||
|
throw new Exception("The method or operation is not implemented.");
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -152,5 +152,33 @@ namespace OpenSim.Framework.Communications.Cache
|
||||||
}
|
}
|
||||||
return folderList;
|
return folderList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// rex, new function
|
||||||
|
public void ClearFolder()
|
||||||
|
{
|
||||||
|
Items.Clear();
|
||||||
|
SubFolders.Clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
// rex, new function
|
||||||
|
public bool HasAssetID(LLUUID assetID)
|
||||||
|
{
|
||||||
|
foreach (InventoryItemBase item in Items.Values)
|
||||||
|
{
|
||||||
|
if (item.assetID == assetID)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (InventoryFolderImpl folder in SubFolders.Values)
|
||||||
|
{
|
||||||
|
if (folder.name != "World Library")
|
||||||
|
{
|
||||||
|
if (folder.HasAssetID(assetID))
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1,86 @@
|
||||||
|
// Rex, new file
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Xml;
|
||||||
|
using libsecondlife;
|
||||||
|
using Nini.Config;
|
||||||
|
|
||||||
|
using OpenSim.Framework.Console;
|
||||||
|
|
||||||
|
namespace OpenSim.Framework.Communications.Cache
|
||||||
|
{
|
||||||
|
// Rex, new class implementing the world assets folder
|
||||||
|
public class RexWorldAssetsFolder : InventoryFolderImpl
|
||||||
|
{
|
||||||
|
private LLUUID libOwner = new LLUUID("11111111-1111-0000-0000-000100bba001");
|
||||||
|
private InventoryFolderImpl m_WorldTexturesFolder;
|
||||||
|
private InventoryFolderImpl m_World3DModelsFolder;
|
||||||
|
private AssetCache AssetCache;
|
||||||
|
|
||||||
|
public RexWorldAssetsFolder(AssetCache vAssetCache)
|
||||||
|
{
|
||||||
|
MainLog.Instance.Verbose("LIBRARYINVENTORY", "Creating World library folder");
|
||||||
|
AssetCache = vAssetCache;
|
||||||
|
|
||||||
|
agentID = libOwner;
|
||||||
|
folderID = new LLUUID("00000112-000f-0000-0000-000100bba005");
|
||||||
|
name = "World Library";
|
||||||
|
parentID = new LLUUID("00000112-000f-0000-0000-000100bba000");
|
||||||
|
type = (short)8;
|
||||||
|
version = (ushort)1;
|
||||||
|
|
||||||
|
CreateNewSubFolder(new LLUUID("00000112-000f-0000-0000-000100bba006"), "Textures", (ushort)8);
|
||||||
|
m_WorldTexturesFolder = HasSubFolder("00000112-000f-0000-0000-000100bba006");
|
||||||
|
|
||||||
|
CreateNewSubFolder(new LLUUID("00000112-000f-0000-0000-000100bba007"), "3D Models", (ushort)8);
|
||||||
|
m_World3DModelsFolder = HasSubFolder("00000112-000f-0000-0000-000100bba007");
|
||||||
|
}
|
||||||
|
|
||||||
|
public InventoryItemBase CreateItem(LLUUID inventoryID, LLUUID assetID, string name, string description,
|
||||||
|
int assetType, int invType, LLUUID parentFolderID)
|
||||||
|
{
|
||||||
|
InventoryItemBase item = new InventoryItemBase();
|
||||||
|
item.avatarID = libOwner;
|
||||||
|
item.creatorsID = libOwner;
|
||||||
|
item.inventoryID = inventoryID;
|
||||||
|
item.assetID = assetID;
|
||||||
|
item.inventoryDescription = description;
|
||||||
|
item.inventoryName = name;
|
||||||
|
item.assetType = assetType;
|
||||||
|
item.invType = invType;
|
||||||
|
item.parentFolderID = parentFolderID;
|
||||||
|
item.inventoryBasePermissions = 0x7FFFFFFF;
|
||||||
|
item.inventoryEveryOnePermissions = 0x7FFFFFFF;
|
||||||
|
item.inventoryCurrentPermissions = 0x7FFFFFFF;
|
||||||
|
item.inventoryNextPermissions = 0x7FFFFFFF;
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Rex, function added.
|
||||||
|
public void UpdateWorldAssetFolders()
|
||||||
|
{
|
||||||
|
// Textures
|
||||||
|
List<AssetBase> allTex = AssetCache.GetAssetList(0);
|
||||||
|
m_WorldTexturesFolder.ClearFolder();
|
||||||
|
|
||||||
|
InventoryItemBase item;
|
||||||
|
foreach (AssetBase asset in allTex)
|
||||||
|
{
|
||||||
|
item = CreateItem(LLUUID.Random(), asset.FullID, asset.Name, asset.Description, (int)AssetType.Texture, (int)InventoryType.Texture, m_WorldTexturesFolder.folderID);
|
||||||
|
m_WorldTexturesFolder.Items.Add(item.inventoryID, item);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3D Models
|
||||||
|
List<AssetBase> allModels = AssetCache.GetAssetList(6);
|
||||||
|
m_World3DModelsFolder.ClearFolder();
|
||||||
|
foreach (AssetBase asset in allModels)
|
||||||
|
{
|
||||||
|
if (asset.Name != "Primitive")
|
||||||
|
{
|
||||||
|
item = CreateItem(LLUUID.Random(), asset.FullID, asset.Name, asset.Description, 43, 6, m_World3DModelsFolder.folderID);
|
||||||
|
m_World3DModelsFolder.Items.Add(item.inventoryID, item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -77,6 +77,12 @@ namespace OpenSim.Framework.Communications.Cache
|
||||||
m_assetProvider.CommitAssets();
|
m_assetProvider.CommitAssets();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// rex new function for "replace assets" functionality
|
||||||
|
public override libsecondlife.LLUUID ExistsAsset(sbyte assetType, string name)
|
||||||
|
{
|
||||||
|
return m_assetProvider.ExistsAsset(assetType, name);
|
||||||
|
}
|
||||||
|
|
||||||
protected override AssetBase GetAsset(AssetRequest req)
|
protected override AssetBase GetAsset(AssetRequest req)
|
||||||
{
|
{
|
||||||
AssetBase asset;
|
AssetBase asset;
|
||||||
|
|
|
@ -38,11 +38,19 @@ namespace OpenSim.Framework.Communications.Cache
|
||||||
private readonly Dictionary<LLUUID, CachedUserInfo> m_userProfiles = new Dictionary<LLUUID, CachedUserInfo>();
|
private readonly Dictionary<LLUUID, CachedUserInfo> m_userProfiles = new Dictionary<LLUUID, CachedUserInfo>();
|
||||||
|
|
||||||
public LibraryRootFolder libraryRoot = new LibraryRootFolder();
|
public LibraryRootFolder libraryRoot = new LibraryRootFolder();
|
||||||
|
public RexWorldAssetsFolder worldlibraryRoot = null; // rex added
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
public UserProfileCacheService(CommunicationsManager parent)
|
public UserProfileCacheService(CommunicationsManager parent)
|
||||||
{
|
{
|
||||||
m_parent = parent;
|
m_parent = parent;
|
||||||
|
// rex, added worldlibrary
|
||||||
|
if (GlobalSettings.Instance.ConfigSource.Configs["Startup"].GetBoolean("worldlibraryfolder", true))
|
||||||
|
{
|
||||||
|
worldlibraryRoot = new RexWorldAssetsFolder(m_parent.AssetCache);
|
||||||
|
libraryRoot.CreateNewSubFolder(new LLUUID("00000112-000f-0000-0000-000100bba005"), "World Library", (ushort)8);
|
||||||
|
}
|
||||||
|
// rexend
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -58,7 +66,7 @@ namespace OpenSim.Framework.Communications.Cache
|
||||||
if (!m_userProfiles.ContainsKey(userID))
|
if (!m_userProfiles.ContainsKey(userID))
|
||||||
{
|
{
|
||||||
CachedUserInfo userInfo = new CachedUserInfo(m_parent);
|
CachedUserInfo userInfo = new CachedUserInfo(m_parent);
|
||||||
userInfo.UserProfile = m_parent.UserService.GetUserProfile(userID);
|
userInfo.UserProfile = m_parent.UserService.GetUserProfile(userID, "");
|
||||||
|
|
||||||
if (userInfo.UserProfile != null)
|
if (userInfo.UserProfile != null)
|
||||||
{
|
{
|
||||||
|
@ -75,6 +83,39 @@ namespace OpenSim.Framework.Communications.Cache
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Rex mode
|
||||||
|
/// <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, string authAddr)
|
||||||
|
{
|
||||||
|
// Potential fix - Multithreading issue.
|
||||||
|
lock (m_userProfiles)
|
||||||
|
{
|
||||||
|
if (!m_userProfiles.ContainsKey(userID))
|
||||||
|
{
|
||||||
|
CachedUserInfo userInfo = new CachedUserInfo(m_parent);
|
||||||
|
userInfo.UserProfile = m_parent.UserService.GetUserProfile(userID, authAddr);
|
||||||
|
|
||||||
|
if (userInfo.UserProfile != null)
|
||||||
|
{
|
||||||
|
//RequestInventoryForUser(userID, userInfo);
|
||||||
|
// The request itself will occur when the agent finishes logging on to the region
|
||||||
|
// so there's no need to do it here.
|
||||||
|
//RequestInventoryForUser(userID, userInfo);
|
||||||
|
m_userProfiles.Add(userID, userInfo);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
System.Console.WriteLine("CACHE", "User profile for user not found");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public void UpdateUserInventory(LLUUID userID)
|
public void UpdateUserInventory(LLUUID userID)
|
||||||
{
|
{
|
||||||
CachedUserInfo userInfo = GetUserDetails(userID);
|
CachedUserInfo userInfo = GetUserDetails(userID);
|
||||||
|
@ -183,6 +224,29 @@ namespace OpenSim.Framework.Communications.Cache
|
||||||
// XXX We're not handling sortOrder yet!
|
// XXX We're not handling sortOrder yet!
|
||||||
|
|
||||||
InventoryFolderImpl fold = null;
|
InventoryFolderImpl fold = null;
|
||||||
|
|
||||||
|
// rex, added worldassetfolder
|
||||||
|
if (worldlibraryRoot != null)
|
||||||
|
{
|
||||||
|
if (folderID == worldlibraryRoot.folderID)
|
||||||
|
{
|
||||||
|
remoteClient.SendInventoryFolderDetails(
|
||||||
|
worldlibraryRoot.agentID, worldlibraryRoot.folderID, worldlibraryRoot.RequestListOfItems(),
|
||||||
|
worldlibraryRoot.RequestListOfFolders(), fetchFolders, fetchItems);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if ((fold = worldlibraryRoot.HasSubFolder(folderID)) != null)
|
||||||
|
{
|
||||||
|
worldlibraryRoot.UpdateWorldAssetFolders();
|
||||||
|
remoteClient.SendInventoryFolderDetails(
|
||||||
|
worldlibraryRoot.agentID, folderID, fold.RequestListOfItems(),
|
||||||
|
fold.RequestListOfFolders(), fetchFolders, fetchItems);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// rex-end
|
||||||
|
|
||||||
if (folderID == libraryRoot.folderID)
|
if (folderID == libraryRoot.folderID)
|
||||||
{
|
{
|
||||||
remoteClient.SendInventoryFolderDetails(
|
remoteClient.SendInventoryFolderDetails(
|
||||||
|
|
|
@ -47,6 +47,9 @@ namespace OpenSim.Region.Capabilities
|
||||||
|
|
||||||
public delegate void NewInventoryItem(LLUUID userID, InventoryItemBase item);
|
public delegate void NewInventoryItem(LLUUID userID, InventoryItemBase item);
|
||||||
|
|
||||||
|
// rex, added for asset replace functionality
|
||||||
|
public delegate bool InventoryAssetCheck(LLUUID userID, LLUUID assetID);
|
||||||
|
|
||||||
public delegate LLUUID ItemUpdatedCallback(LLUUID userID, LLUUID itemID, byte[] data);
|
public delegate LLUUID ItemUpdatedCallback(LLUUID userID, LLUUID itemID, byte[] data);
|
||||||
|
|
||||||
public delegate void TaskScriptUpdatedCallback(LLUUID userID, LLUUID itemID, LLUUID primID,
|
public delegate void TaskScriptUpdatedCallback(LLUUID userID, LLUUID itemID, LLUUID primID,
|
||||||
|
@ -72,10 +75,12 @@ namespace OpenSim.Region.Capabilities
|
||||||
private int m_eventQueueCount = 1;
|
private int m_eventQueueCount = 1;
|
||||||
private Queue<string> m_capsEventQueue = new Queue<string>();
|
private Queue<string> m_capsEventQueue = new Queue<string>();
|
||||||
private bool m_dumpAssetsToFile;
|
private bool m_dumpAssetsToFile;
|
||||||
|
private bool m_replaceAssets;
|
||||||
|
|
||||||
// These are callbacks which will be setup by the scene so that we can update scene data when we
|
// These are callbacks which will be setup by the scene so that we can update scene data when we
|
||||||
// receive capability calls
|
// receive capability calls
|
||||||
public NewInventoryItem AddNewInventoryItem = null;
|
public NewInventoryItem AddNewInventoryItem = null;
|
||||||
|
public InventoryAssetCheck CheckInventoryForAsset = null;
|
||||||
public ItemUpdatedCallback ItemUpdatedCall = null;
|
public ItemUpdatedCallback ItemUpdatedCall = null;
|
||||||
public TaskScriptUpdatedCallback TaskScriptUpdatedCall = null;
|
public TaskScriptUpdatedCallback TaskScriptUpdatedCall = null;
|
||||||
|
|
||||||
|
@ -89,6 +94,8 @@ namespace OpenSim.Region.Capabilities
|
||||||
m_httpListenPort = httpPort;
|
m_httpListenPort = httpPort;
|
||||||
m_agentID = agent;
|
m_agentID = agent;
|
||||||
m_dumpAssetsToFile = dumpAssetsToFile;
|
m_dumpAssetsToFile = dumpAssetsToFile;
|
||||||
|
|
||||||
|
m_replaceAssets = (GlobalSettings.Instance.ConfigSource.Configs["Startup"].GetBoolean("replace_assets", true));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -374,6 +381,28 @@ namespace OpenSim.Region.Capabilities
|
||||||
LLUUID parentFolder = llsdRequest.folder_id;
|
LLUUID parentFolder = llsdRequest.folder_id;
|
||||||
string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000");
|
string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000");
|
||||||
|
|
||||||
|
// rex, modified for "replace assets" functionality
|
||||||
|
if (m_replaceAssets)
|
||||||
|
{
|
||||||
|
// Check for asset replace upload
|
||||||
|
sbyte assType = 0;
|
||||||
|
sbyte inType = 0;
|
||||||
|
ParseAssetAndInventoryType(llsdRequest.asset_type, llsdRequest.inventory_type, out assType, out inType);
|
||||||
|
LLUUID dupID = m_assetCache.ExistsAsset(assType, llsdRequest.name);
|
||||||
|
if (dupID != LLUUID.Zero)
|
||||||
|
{
|
||||||
|
// If duplicate (same name and same assettype) found, use old asset UUID
|
||||||
|
newAsset = dupID;
|
||||||
|
// If user already has this asset in inventory, create no item
|
||||||
|
if (CheckInventoryForAsset != null)
|
||||||
|
{
|
||||||
|
if (CheckInventoryForAsset(m_agentID, dupID))
|
||||||
|
newInvItem = LLUUID.Zero;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// rexend
|
||||||
|
|
||||||
AssetUploader uploader =
|
AssetUploader uploader =
|
||||||
new AssetUploader(assetName, assetDes, newAsset, newInvItem, parentFolder, llsdRequest.inventory_type,
|
new AssetUploader(assetName, assetDes, newAsset, newInvItem, parentFolder, llsdRequest.inventory_type,
|
||||||
llsdRequest.asset_type, capsBase + uploaderPath, m_httpListener, m_dumpAssetsToFile);
|
llsdRequest.asset_type, capsBase + uploaderPath, m_httpListener, m_dumpAssetsToFile);
|
||||||
|
@ -402,16 +431,8 @@ namespace OpenSim.Region.Capabilities
|
||||||
sbyte assType = 0;
|
sbyte assType = 0;
|
||||||
sbyte inType = 0;
|
sbyte inType = 0;
|
||||||
|
|
||||||
if (inventoryType == "sound")
|
// rex, modified to use extracted method, because needed in multiple places
|
||||||
{
|
ParseAssetAndInventoryType(assetType, inventoryType, out assType, out inType);
|
||||||
inType = 1;
|
|
||||||
assType = 1;
|
|
||||||
}
|
|
||||||
else if (inventoryType == "animation")
|
|
||||||
{
|
|
||||||
inType = 19;
|
|
||||||
assType = 20;
|
|
||||||
}
|
|
||||||
|
|
||||||
AssetBase asset;
|
AssetBase asset;
|
||||||
asset = new AssetBase();
|
asset = new AssetBase();
|
||||||
|
@ -420,8 +441,20 @@ namespace OpenSim.Region.Capabilities
|
||||||
asset.InvType = inType;
|
asset.InvType = inType;
|
||||||
asset.Name = assetName;
|
asset.Name = assetName;
|
||||||
asset.Data = data;
|
asset.Data = data;
|
||||||
m_assetCache.AddAsset(asset);
|
|
||||||
|
|
||||||
|
// rex, modified for "replace assets" functionality
|
||||||
|
bool replace = (m_assetCache.ExistsAsset(assetID));
|
||||||
|
if (replace)
|
||||||
|
{
|
||||||
|
m_assetCache.ReplaceAsset(asset);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_assetCache.AddAsset(asset);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (inventoryItem != LLUUID.Zero)
|
||||||
|
{
|
||||||
InventoryItemBase item = new InventoryItemBase();
|
InventoryItemBase item = new InventoryItemBase();
|
||||||
item.avatarID = m_agentID;
|
item.avatarID = m_agentID;
|
||||||
item.creatorsID = m_agentID;
|
item.creatorsID = m_agentID;
|
||||||
|
@ -440,6 +473,39 @@ namespace OpenSim.Region.Capabilities
|
||||||
AddNewInventoryItem(m_agentID, item);
|
AddNewInventoryItem(m_agentID, item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// rexend
|
||||||
|
}
|
||||||
|
|
||||||
|
// rex, new function (extracted method) with added Ogre asset support
|
||||||
|
private void ParseAssetAndInventoryType(string assetType, string inventoryType, out sbyte assType, out sbyte inType)
|
||||||
|
{
|
||||||
|
inType = 0;
|
||||||
|
assType = 0;
|
||||||
|
|
||||||
|
if (inventoryType == "sound")
|
||||||
|
{
|
||||||
|
inType = 1;
|
||||||
|
assType = 1;
|
||||||
|
}
|
||||||
|
else if (inventoryType == "animation")
|
||||||
|
{
|
||||||
|
inType = 19;
|
||||||
|
assType = 20;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (assetType == "ogremesh")
|
||||||
|
{
|
||||||
|
inType = 6;
|
||||||
|
assType = 43;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (assetType == "ogrepart")
|
||||||
|
{
|
||||||
|
inType = 41;
|
||||||
|
assType = 47;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Called when new asset data for an agent inventory item update has been uploaded.
|
/// Called when new asset data for an agent inventory item update has been uploaded.
|
||||||
|
|
|
@ -139,7 +139,7 @@ namespace OpenSim.Framework.Communications
|
||||||
string md5PasswdHash = Util.Md5Hash(Util.Md5Hash(password) + ":" + "");
|
string md5PasswdHash = Util.Md5Hash(Util.Md5Hash(password) + ":" + "");
|
||||||
|
|
||||||
m_userService.AddUserProfile(firstName, lastName, md5PasswdHash, regX, regY);
|
m_userService.AddUserProfile(firstName, lastName, md5PasswdHash, regX, regY);
|
||||||
UserProfileData userProf = UserService.GetUserProfile(firstName, lastName);
|
UserProfileData userProf = UserService.GetUserProfile(firstName, lastName, "");
|
||||||
if (userProf == null)
|
if (userProf == null)
|
||||||
{
|
{
|
||||||
return LLUUID.Zero;
|
return LLUUID.Zero;
|
||||||
|
@ -205,7 +205,7 @@ namespace OpenSim.Framework.Communications
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
UserProfileData profileData = m_userService.GetUserProfile(uuid);
|
UserProfileData profileData = m_userService.GetUserProfile(uuid, "");
|
||||||
if (profileData != null)
|
if (profileData != null)
|
||||||
{
|
{
|
||||||
LLUUID profileId = profileData.UUID;
|
LLUUID profileId = profileData.UUID;
|
||||||
|
|
|
@ -82,6 +82,9 @@ namespace OpenSim.Framework.UserManagement
|
||||||
private string firstname;
|
private string firstname;
|
||||||
private string lastname;
|
private string lastname;
|
||||||
|
|
||||||
|
// REX (client version string)
|
||||||
|
private string clientVersion = "not set";
|
||||||
|
|
||||||
// Global Textures
|
// Global Textures
|
||||||
private string sunTexture;
|
private string sunTexture;
|
||||||
private string cloudTexture;
|
private string cloudTexture;
|
||||||
|
@ -158,6 +161,8 @@ namespace OpenSim.Framework.UserManagement
|
||||||
RegionX = (uint) 255232;
|
RegionX = (uint) 255232;
|
||||||
RegionY = (uint) 254976;
|
RegionY = (uint) 254976;
|
||||||
|
|
||||||
|
clientVersion = "not set"; //rex
|
||||||
|
|
||||||
// Classifieds;
|
// Classifieds;
|
||||||
AddClassifiedCategory((Int32) 1, "Shopping");
|
AddClassifiedCategory((Int32) 1, "Shopping");
|
||||||
AddClassifiedCategory((Int32) 2, "Land Rental");
|
AddClassifiedCategory((Int32) 2, "Land Rental");
|
||||||
|
@ -348,6 +353,8 @@ namespace OpenSim.Framework.UserManagement
|
||||||
responseData["region_x"] = (Int32) RegionX*256;
|
responseData["region_x"] = (Int32) RegionX*256;
|
||||||
responseData["region_y"] = (Int32) RegionY*256;
|
responseData["region_y"] = (Int32) RegionY*256;
|
||||||
|
|
||||||
|
responseData["version"] = clientVersion; //rex
|
||||||
|
|
||||||
//responseData["inventory-lib-root"] = new ArrayList(); // todo
|
//responseData["inventory-lib-root"] = new ArrayList(); // todo
|
||||||
|
|
||||||
if (m_buddyList != null)
|
if (m_buddyList != null)
|
||||||
|
@ -450,6 +457,8 @@ namespace OpenSim.Framework.UserManagement
|
||||||
map["region_x"] = LLSD.FromInteger(RegionX * 256);
|
map["region_x"] = LLSD.FromInteger(RegionX * 256);
|
||||||
map["region_y"] = LLSD.FromInteger(RegionY * 256);
|
map["region_y"] = LLSD.FromInteger(RegionY * 256);
|
||||||
|
|
||||||
|
map["version"] = LLSD.FromString(clientVersion); //rex
|
||||||
|
|
||||||
if (m_buddyList != null)
|
if (m_buddyList != null)
|
||||||
{
|
{
|
||||||
//map["buddy-list"] = m_buddyList.ToArray();
|
//map["buddy-list"] = m_buddyList.ToArray();
|
||||||
|
@ -606,6 +615,12 @@ namespace OpenSim.Framework.UserManagement
|
||||||
set { lastname = value; }
|
set { lastname = value; }
|
||||||
} // Lastname
|
} // Lastname
|
||||||
|
|
||||||
|
public string ClientVersion
|
||||||
|
{
|
||||||
|
get { return clientVersion; }
|
||||||
|
set { clientVersion = value; }
|
||||||
|
} //REX ClientVersion
|
||||||
|
|
||||||
public string AgentAccess
|
public string AgentAccess
|
||||||
{
|
{
|
||||||
get { return agentAccess; }
|
get { return agentAccess; }
|
||||||
|
|
|
@ -44,6 +44,9 @@ namespace OpenSim.Framework.UserManagement
|
||||||
protected string m_welcomeMessage = "Welcome to OpenSim";
|
protected string m_welcomeMessage = "Welcome to OpenSim";
|
||||||
protected UserManagerBase m_userManager = null;
|
protected UserManagerBase m_userManager = null;
|
||||||
protected Mutex m_loginMutex = new Mutex(false);
|
protected Mutex m_loginMutex = new Mutex(false);
|
||||||
|
protected Boolean m_rexMode;
|
||||||
|
protected RexLoginHandler m_rexLoginHandler;
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Used during login to send the skeleton of the OpenSim Library to the client.
|
/// Used during login to send the skeleton of the OpenSim Library to the client.
|
||||||
|
@ -51,10 +54,14 @@ namespace OpenSim.Framework.UserManagement
|
||||||
protected LibraryRootFolder m_libraryRootFolder;
|
protected LibraryRootFolder m_libraryRootFolder;
|
||||||
|
|
||||||
public LoginService(
|
public LoginService(
|
||||||
UserManagerBase userManager, LibraryRootFolder libraryRootFolder, string welcomeMess)
|
UserManagerBase userManager, LibraryRootFolder libraryRootFolder, string welcomeMess, Boolean rexMode)
|
||||||
{
|
{
|
||||||
m_userManager = userManager;
|
m_userManager = userManager;
|
||||||
m_libraryRootFolder = libraryRootFolder;
|
m_libraryRootFolder = libraryRootFolder;
|
||||||
|
m_rexMode = rexMode;
|
||||||
|
m_userManager.RexMode = rexMode;
|
||||||
|
if (m_rexMode)
|
||||||
|
m_rexLoginHandler = new RexLoginHandler(this, m_userManager);
|
||||||
|
|
||||||
if (welcomeMess != "")
|
if (welcomeMess != "")
|
||||||
{
|
{
|
||||||
|
@ -72,6 +79,8 @@ namespace OpenSim.Framework.UserManagement
|
||||||
// Temporary fix
|
// Temporary fix
|
||||||
m_loginMutex.WaitOne();
|
m_loginMutex.WaitOne();
|
||||||
try
|
try
|
||||||
|
{
|
||||||
|
if (!m_rexMode)
|
||||||
{
|
{
|
||||||
//CFK: CustomizeResponse contains sufficient strings to alleviate the need for this.
|
//CFK: CustomizeResponse contains sufficient strings to alleviate the need for this.
|
||||||
//CKF: MainLog.Instance.Verbose("LOGIN", "Attempting login now...");
|
//CKF: MainLog.Instance.Verbose("LOGIN", "Attempting login now...");
|
||||||
|
@ -91,7 +100,7 @@ namespace OpenSim.Framework.UserManagement
|
||||||
string lastname = (string) requestData["last"];
|
string lastname = (string) requestData["last"];
|
||||||
string passwd = (string) requestData["passwd"];
|
string passwd = (string) requestData["passwd"];
|
||||||
|
|
||||||
userProfile = GetTheUser(firstname, lastname);
|
userProfile = GetTheUser(firstname, lastname, "");
|
||||||
if (userProfile == null)
|
if (userProfile == null)
|
||||||
{
|
{
|
||||||
MainLog.Instance.Verbose(
|
MainLog.Instance.Verbose(
|
||||||
|
@ -145,6 +154,12 @@ namespace OpenSim.Framework.UserManagement
|
||||||
// Circuit Code
|
// Circuit Code
|
||||||
uint circode = (uint) (Util.RandomClass.Next());
|
uint circode = (uint) (Util.RandomClass.Next());
|
||||||
|
|
||||||
|
//REX: Get client version
|
||||||
|
if (requestData.ContainsKey("version"))
|
||||||
|
{
|
||||||
|
logResponse.ClientVersion = (string)requestData["version"];
|
||||||
|
}
|
||||||
|
|
||||||
logResponse.Lastname = userProfile.surname;
|
logResponse.Lastname = userProfile.surname;
|
||||||
logResponse.Firstname = userProfile.username;
|
logResponse.Firstname = userProfile.username;
|
||||||
logResponse.AgentID = agentID.ToString();
|
logResponse.AgentID = agentID.ToString();
|
||||||
|
@ -173,7 +188,7 @@ namespace OpenSim.Framework.UserManagement
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
CustomiseResponse(logResponse, userProfile);
|
CustomiseResponse(logResponse, userProfile, null);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
@ -193,6 +208,11 @@ namespace OpenSim.Framework.UserManagement
|
||||||
}
|
}
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return m_rexLoginHandler.XmlRpcLoginMethod(request);
|
||||||
|
}
|
||||||
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
m_loginMutex.ReleaseMutex();
|
m_loginMutex.ReleaseMutex();
|
||||||
|
@ -201,12 +221,16 @@ namespace OpenSim.Framework.UserManagement
|
||||||
|
|
||||||
public LLSD LLSDLoginMethod(LLSD request)
|
public LLSD LLSDLoginMethod(LLSD request)
|
||||||
{
|
{
|
||||||
|
|
||||||
// Temporary fix
|
// Temporary fix
|
||||||
m_loginMutex.WaitOne();
|
m_loginMutex.WaitOne();
|
||||||
|
|
||||||
try
|
try
|
||||||
|
{
|
||||||
|
if (!m_rexMode)
|
||||||
{
|
{
|
||||||
bool GoodLogin = false;
|
bool GoodLogin = false;
|
||||||
|
string clientVersion = "not set"; //rex
|
||||||
|
|
||||||
UserProfileData userProfile = null;
|
UserProfileData userProfile = null;
|
||||||
LoginResponse logResponse = new LoginResponse();
|
LoginResponse logResponse = new LoginResponse();
|
||||||
|
@ -221,7 +245,13 @@ namespace OpenSim.Framework.UserManagement
|
||||||
string lastname = map["last"].AsString();
|
string lastname = map["last"].AsString();
|
||||||
string passwd = map["passwd"].AsString();
|
string passwd = map["passwd"].AsString();
|
||||||
|
|
||||||
userProfile = GetTheUser(firstname, lastname);
|
//REX: Client version
|
||||||
|
if (map.ContainsKey("version"))
|
||||||
|
{
|
||||||
|
clientVersion = map["version"].AsString();
|
||||||
|
}
|
||||||
|
|
||||||
|
userProfile = GetTheUser(firstname, lastname, "");
|
||||||
if (userProfile == null)
|
if (userProfile == null)
|
||||||
{
|
{
|
||||||
MainLog.Instance.Verbose(
|
MainLog.Instance.Verbose(
|
||||||
|
@ -272,6 +302,9 @@ namespace OpenSim.Framework.UserManagement
|
||||||
// Circuit Code
|
// Circuit Code
|
||||||
uint circode = (uint)(Util.RandomClass.Next());
|
uint circode = (uint)(Util.RandomClass.Next());
|
||||||
|
|
||||||
|
// REX: Set client version
|
||||||
|
logResponse.ClientVersion = clientVersion;
|
||||||
|
|
||||||
logResponse.Lastname = userProfile.surname;
|
logResponse.Lastname = userProfile.surname;
|
||||||
logResponse.Firstname = userProfile.username;
|
logResponse.Firstname = userProfile.username;
|
||||||
logResponse.AgentID = agentID.ToString();
|
logResponse.AgentID = agentID.ToString();
|
||||||
|
@ -300,7 +333,7 @@ namespace OpenSim.Framework.UserManagement
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
CustomiseResponse(logResponse, userProfile);
|
CustomiseResponse(logResponse, userProfile, null);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
@ -319,21 +352,101 @@ namespace OpenSim.Framework.UserManagement
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return m_rexLoginHandler.LLSDLoginMethod(request);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
m_loginMutex.ReleaseMutex();
|
m_loginMutex.ReleaseMutex();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
/// <summary>
|
||||||
|
/// Remove agent
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="request">The XMLRPC request</param>
|
||||||
|
/// <returns>The response to send</returns>
|
||||||
|
public XmlRpcResponse XmlRpcRemoveAgentMethod(XmlRpcRequest request)
|
||||||
|
{
|
||||||
|
// Temporary fix
|
||||||
|
m_loginMutex.WaitOne();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
MainLog.Instance.Verbose("REMOVE AGENT", "Attempting to remove agent...");
|
||||||
|
XmlRpcResponse response = new XmlRpcResponse();
|
||||||
|
Hashtable requestData = (Hashtable)request.Params[0];
|
||||||
|
|
||||||
|
bool parametersValid = (requestData.Contains("agentID"));
|
||||||
|
|
||||||
|
UserProfileData user;
|
||||||
|
LoginResponse logResponse = new LoginResponse();
|
||||||
|
|
||||||
|
if (parametersValid)
|
||||||
|
{
|
||||||
|
string agentID = (string)requestData["agentID"];
|
||||||
|
user = GetTheUser((libsecondlife.LLUUID)agentID);
|
||||||
|
|
||||||
|
if (user == null)
|
||||||
|
{
|
||||||
|
MainLog.Instance.Verbose("REMOVE AGENT", "Failed. UserProfile not found.");
|
||||||
|
return logResponse.CreateAgentRemoveFailedResponse();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (user != null)
|
||||||
|
{
|
||||||
|
ClearUserAgent(ref user, user.authenticationAddr);
|
||||||
|
MainLog.Instance.Verbose("REMOVE AGENT", "Success. Agent removed from database. UUID = " + user.UUID);
|
||||||
|
return logResponse.GenerateAgentRemoveSuccessResponse();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
MainLog.Instance.Verbose("REMOVE AGENT", "Failed. Parameters invalid.");
|
||||||
|
return logResponse.CreateAgentRemoveFailedResponse();
|
||||||
|
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
m_loginMutex.ReleaseMutex();
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}//*/
|
||||||
|
|
||||||
|
public void ClearUserAgent(ref UserProfileData profile, string authAddr)
|
||||||
|
{
|
||||||
|
m_userManager.clearUserAgent(profile.UUID, authAddr);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Customises the login response and fills in missing values.
|
/// Customises the login response and fills in missing values.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="response">The existing response</param>
|
/// <param name="response">The existing response</param>
|
||||||
/// <param name="theUser">The user profile</param>
|
/// <param name="theUser">The user profile</param>
|
||||||
public virtual void CustomiseResponse(LoginResponse response, UserProfileData theUser)
|
public virtual void CustomiseResponse(LoginResponse response, UserProfileData theUser, string ASaddress)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Saves a target agent to the database
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="profile">The users profile</param>
|
||||||
|
/// <returns>Successful?</returns>
|
||||||
|
public void UpdateAgent(UserAgentData agent, string authAddr)
|
||||||
|
{
|
||||||
|
// Saves the agent to database
|
||||||
|
//return true;
|
||||||
|
m_userManager.UpdateUserAgentData(agent.UUID, agent.agentOnline, agent.currentPos, agent.logoutTime, authAddr);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Saves a target agent to the database
|
/// Saves a target agent to the database
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -384,9 +497,29 @@ namespace OpenSim.Framework.UserManagement
|
||||||
/// <param name="firstname"></param>
|
/// <param name="firstname"></param>
|
||||||
/// <param name="lastname"></param>
|
/// <param name="lastname"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public virtual UserProfileData GetTheUser(string firstname, string lastname)
|
public virtual UserProfileData GetTheUser(string firstname, string lastname, string authAddr)
|
||||||
{
|
{
|
||||||
return m_userManager.GetUserProfile(firstname, lastname);
|
return m_userManager.GetUserProfile(firstname, lastname, authAddr);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get user according to uid
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="userUID"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public virtual UserProfileData GetTheUser(LLUUID userUID)
|
||||||
|
{
|
||||||
|
return this.m_userManager.GetUserProfile(userUID, "");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get user according to account
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="account"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public virtual UserProfileData GetTheUserByAccount(string account)
|
||||||
|
{
|
||||||
|
return this.m_userManager.GetUserProfileByAccount(account);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -417,7 +550,7 @@ namespace OpenSim.Framework.UserManagement
|
||||||
/// Converts the inventory library skeleton into the form required by the rpc request.
|
/// Converts the inventory library skeleton into the form required by the rpc request.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
protected virtual ArrayList GetInventoryLibrary()
|
protected internal virtual ArrayList GetInventoryLibrary()
|
||||||
{
|
{
|
||||||
Dictionary<LLUUID, InventoryFolderImpl> rootFolders
|
Dictionary<LLUUID, InventoryFolderImpl> rootFolders
|
||||||
= m_libraryRootFolder.RequestSelfAndDescendentFolders();
|
= m_libraryRootFolder.RequestSelfAndDescendentFolders();
|
||||||
|
@ -441,7 +574,7 @@ namespace OpenSim.Framework.UserManagement
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
protected virtual ArrayList GetLibraryOwner()
|
protected internal virtual ArrayList GetLibraryOwner()
|
||||||
{
|
{
|
||||||
//for now create random inventory library owner
|
//for now create random inventory library owner
|
||||||
Hashtable TempHash = new Hashtable();
|
Hashtable TempHash = new Hashtable();
|
||||||
|
@ -451,7 +584,7 @@ namespace OpenSim.Framework.UserManagement
|
||||||
return inventoryLibOwner;
|
return inventoryLibOwner;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual InventoryData CreateInventoryData(LLUUID userID)
|
protected internal virtual InventoryData CreateInventoryData(LLUUID userID)
|
||||||
{
|
{
|
||||||
AgentInventory userInventory = new AgentInventory();
|
AgentInventory userInventory = new AgentInventory();
|
||||||
userInventory.CreateRootFolder(userID, false);
|
userInventory.CreateRootFolder(userID, false);
|
||||||
|
|
|
@ -0,0 +1,377 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Threading;
|
||||||
|
using libsecondlife.StructuredData;
|
||||||
|
using libsecondlife;
|
||||||
|
using Nwc.XmlRpc;
|
||||||
|
using OpenSim.Framework.Console;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
namespace OpenSim.Framework.UserManagement
|
||||||
|
{
|
||||||
|
public class RexLoginHandler
|
||||||
|
{
|
||||||
|
private LoginService m_ls;
|
||||||
|
protected UserManagerBase m_userManager = null;
|
||||||
|
|
||||||
|
public RexLoginHandler(LoginService loginservice, UserManagerBase userManager)
|
||||||
|
{
|
||||||
|
m_ls = loginservice;
|
||||||
|
m_userManager = userManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LLSD LLSDLoginMethod(LLSD request)
|
||||||
|
{
|
||||||
|
string clientVersion = "not set"; //rex
|
||||||
|
|
||||||
|
LoginResponse logResponse = new LoginResponse();
|
||||||
|
|
||||||
|
string account = "";
|
||||||
|
string sessionhash = "";
|
||||||
|
string AuthenticationAddress = "";
|
||||||
|
|
||||||
|
if (request.Type == LLSDType.Map)
|
||||||
|
{
|
||||||
|
LLSDMap map = (LLSDMap)request;
|
||||||
|
|
||||||
|
if (map.ContainsKey("account") && map.ContainsKey("sessionhash") &&
|
||||||
|
map.ContainsKey("AuthenticationAddress"))
|
||||||
|
{
|
||||||
|
account = map["account"].AsString();
|
||||||
|
sessionhash = map["sessionhash"].AsString();
|
||||||
|
AuthenticationAddress = map["AuthenticationAddress"].AsString();
|
||||||
|
|
||||||
|
if (map.ContainsKey("version"))
|
||||||
|
{
|
||||||
|
clientVersion = map["version"].AsString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return logResponse.CreateLoginFailedResponseLLSD();
|
||||||
|
}
|
||||||
|
return (LLSD)CommonLoginProcess(account, sessionhash, AuthenticationAddress, clientVersion, true);
|
||||||
|
}
|
||||||
|
return logResponse.CreateLoginFailedResponseLLSD();
|
||||||
|
}
|
||||||
|
|
||||||
|
public XmlRpcResponse XmlRpcLoginMethod(XmlRpcRequest request)
|
||||||
|
{
|
||||||
|
MainLog.Instance.Verbose("LOGIN", "Attempting login to rexmode sim now...");
|
||||||
|
LoginResponse logResponse = new LoginResponse();
|
||||||
|
|
||||||
|
Hashtable requestData = (Hashtable)request.Params[0];
|
||||||
|
|
||||||
|
bool GoodXML = (//requestData.Contains("first") && requestData.Contains("last") &&
|
||||||
|
requestData.Contains("account") && requestData.Contains("sessionhash") &&
|
||||||
|
requestData.Contains("AuthenticationAddress"));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#region GoodXML // authentication and getting UserProfileData
|
||||||
|
if (GoodXML)
|
||||||
|
{
|
||||||
|
string account = (string)requestData["account"];
|
||||||
|
string sessionhash = (string)requestData["sessionhash"];
|
||||||
|
string AuthenticationAddress = (string)requestData["AuthenticationAddress"];
|
||||||
|
string clientVersion = "not set";
|
||||||
|
if (requestData.ContainsKey("version"))
|
||||||
|
{
|
||||||
|
clientVersion = (string)requestData["version"];
|
||||||
|
}
|
||||||
|
|
||||||
|
return (XmlRpcResponse) CommonLoginProcess(account, sessionhash, AuthenticationAddress,
|
||||||
|
clientVersion, false);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return logResponse.CreateGridErrorResponse();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private object CommonLoginProcess(string account, string sessionhash, string AuthenticationAddress,
|
||||||
|
string clientVersion, bool useLLSD)
|
||||||
|
{
|
||||||
|
string asAddress;
|
||||||
|
UserProfileData userProfile;
|
||||||
|
bool GoodLogin = false;
|
||||||
|
XmlRpcResponse response = new XmlRpcResponse();
|
||||||
|
|
||||||
|
LoginResponse logResponse = new LoginResponse();
|
||||||
|
|
||||||
|
// in rex mode first thing to do is authenticate
|
||||||
|
GoodLogin = AuthenticateUser(account, ref sessionhash, AuthenticationAddress);
|
||||||
|
|
||||||
|
if (!GoodLogin)
|
||||||
|
return logResponse.CreateLoginFailedResponse();
|
||||||
|
|
||||||
|
userProfile = GetTheUser(account, sessionhash, AuthenticationAddress, out asAddress);
|
||||||
|
|
||||||
|
|
||||||
|
if (userProfile == null)
|
||||||
|
{
|
||||||
|
if (!useLLSD)
|
||||||
|
return logResponse.CreateLoginFailedResponse();
|
||||||
|
else
|
||||||
|
return logResponse.CreateAlreadyLoggedInResponseLLSD();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set at least here if not filled elsewhere later...
|
||||||
|
userProfile.authenticationAddr = AuthenticationAddress;
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region GoodLogin // Agent storing issues
|
||||||
|
if (!GoodLogin)
|
||||||
|
{
|
||||||
|
return logResponse.CreateLoginFailedResponse();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// If we already have a session...
|
||||||
|
//if (userProfile.currentAgent != null && userProfile.currentAgent.agentOnline)
|
||||||
|
//{
|
||||||
|
// userProfile.currentAgent = null;
|
||||||
|
|
||||||
|
//m_userManager.CommitAgent(ref userProfile);// not needed
|
||||||
|
// Reject the login
|
||||||
|
// return logResponse.CreateAlreadyLoggedInResponse();
|
||||||
|
//}
|
||||||
|
// Otherwise...
|
||||||
|
// TODO: Actually this is needed at least for now as otherwise crashes to agent being null
|
||||||
|
//m_ls.CreateAgent(userProfile, request); // not needed
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region AllTheRest
|
||||||
|
// All the rest in this method goes like in LoginServices method
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
LLUUID agentID = userProfile.UUID;
|
||||||
|
|
||||||
|
// Inventory Library Section
|
||||||
|
|
||||||
|
OpenSim.Framework.UserManagement.LoginService.InventoryData inventData = m_ls.CreateInventoryData(agentID);
|
||||||
|
ArrayList AgentInventoryArray = inventData.InventoryArray;
|
||||||
|
|
||||||
|
Hashtable InventoryRootHash = new Hashtable();
|
||||||
|
InventoryRootHash["folder_id"] = inventData.RootFolderID.ToString();
|
||||||
|
ArrayList InventoryRoot = new ArrayList();
|
||||||
|
InventoryRoot.Add(InventoryRootHash);
|
||||||
|
userProfile.rootInventoryFolderID = inventData.RootFolderID;
|
||||||
|
|
||||||
|
// Circuit Code
|
||||||
|
uint circode = (uint)(Util.RandomClass.Next());
|
||||||
|
|
||||||
|
logResponse.Lastname = userProfile.surname;
|
||||||
|
logResponse.Firstname = userProfile.username;
|
||||||
|
logResponse.AgentID = agentID.ToString();
|
||||||
|
// TODO: Authentication server does not send these, so use random generated defaults! (at least for now)
|
||||||
|
logResponse.SessionID = userProfile.currentAgent.sessionID.ToString();
|
||||||
|
logResponse.SecureSessionID = userProfile.currentAgent.secureSessionID.ToString();
|
||||||
|
logResponse.InventoryRoot = InventoryRoot;
|
||||||
|
logResponse.InventorySkeleton = AgentInventoryArray;
|
||||||
|
logResponse.InventoryLibrary = m_ls.GetInventoryLibrary();
|
||||||
|
logResponse.ClientVersion = clientVersion;
|
||||||
|
|
||||||
|
Hashtable InventoryLibRootHash = new Hashtable();
|
||||||
|
InventoryLibRootHash["folder_id"] = "00000112-000f-0000-0000-000100bba000";
|
||||||
|
ArrayList InventoryLibRoot = new ArrayList();
|
||||||
|
InventoryLibRoot.Add(InventoryLibRootHash);
|
||||||
|
logResponse.InventoryLibRoot = InventoryLibRoot;
|
||||||
|
|
||||||
|
logResponse.InventoryLibraryOwner = m_ls.GetLibraryOwner();
|
||||||
|
logResponse.CircuitCode = (Int32)circode;
|
||||||
|
//logResponse.RegionX = 0; //overwritten
|
||||||
|
//logResponse.RegionY = 0; //overwritten
|
||||||
|
logResponse.Home = "!!null temporary value {home}!!"; // Overwritten
|
||||||
|
//logResponse.LookAt = "\n[r" + TheUser.homeLookAt.X.ToString() + ",r" + TheUser.homeLookAt.Y.ToString() + ",r" + TheUser.homeLookAt.Z.ToString() + "]\n";
|
||||||
|
//logResponse.SimAddress = "127.0.0.1"; //overwritten
|
||||||
|
//logResponse.SimPort = 0; //overwritten
|
||||||
|
logResponse.Message = m_ls.GetMessage();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
m_ls.CustomiseResponse(logResponse, userProfile, asAddress);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
MainLog.Instance.Verbose("LOGIN", e.ToString());
|
||||||
|
if (!useLLSD)
|
||||||
|
return logResponse.CreateDeadRegionResponse();
|
||||||
|
else
|
||||||
|
return logResponse.CreateDeadRegionResponseLLSD();
|
||||||
|
//return logResponse.ToXmlRpcResponse();
|
||||||
|
}
|
||||||
|
//m_ls.CommitAgent(ref userProfile);
|
||||||
|
if (!useLLSD)
|
||||||
|
return logResponse.ToXmlRpcResponse();
|
||||||
|
else
|
||||||
|
return logResponse.ToLLSDResponse();
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception E)
|
||||||
|
{
|
||||||
|
MainLog.Instance.Verbose("LOGIN", E.ToString());
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
if (!useLLSD)
|
||||||
|
return response;
|
||||||
|
else
|
||||||
|
return logResponse.CreateFailedResponseLLSD();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Does authentication to Authentication server
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="account"></param>
|
||||||
|
/// <param name="loginSessionHash"></param>
|
||||||
|
/// <returns>new sessionhash ?</returns>
|
||||||
|
public bool AuthenticateUser(string account, ref string loginSessionHash, string authenticationAddr)
|
||||||
|
{
|
||||||
|
Hashtable requestParams = new Hashtable();
|
||||||
|
requestParams.Add("account", account);
|
||||||
|
requestParams.Add("sessionhash", loginSessionHash);
|
||||||
|
XmlRpcResponse res = doRequest("SimAuthenticationAccount", requestParams, authenticationAddr);
|
||||||
|
|
||||||
|
if ((string)((Hashtable)res.Value)["login"] == "success")
|
||||||
|
{
|
||||||
|
loginSessionHash = (string)((Hashtable)res.Value)["sessionHash"];
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual UserProfileData GetTheUser(string account, string sessionhash, string authenticationAddr,
|
||||||
|
out string asAddress)
|
||||||
|
{
|
||||||
|
Hashtable requestParams = new Hashtable();
|
||||||
|
requestParams.Add("avatar_account", account);
|
||||||
|
requestParams.Add("sessionhash", sessionhash);
|
||||||
|
XmlRpcResponse res = doRequest("get_user_by_account", requestParams, authenticationAddr);
|
||||||
|
|
||||||
|
// should do better check
|
||||||
|
if ((string)((Hashtable)res.Value)["uuid"] != null)
|
||||||
|
{
|
||||||
|
if ((string)((Hashtable)res.Value)["as_address"] != null)
|
||||||
|
asAddress = (string)((Hashtable)res.Value)["as_address"];
|
||||||
|
else
|
||||||
|
asAddress = "";
|
||||||
|
|
||||||
|
return HashtableToUserProfileData((Hashtable)res.Value);
|
||||||
|
}
|
||||||
|
asAddress = "";
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected XmlRpcResponse doRequest(string method,
|
||||||
|
Hashtable requestParams,
|
||||||
|
string authenticationAddr)
|
||||||
|
{
|
||||||
|
ArrayList SendParams = new ArrayList();
|
||||||
|
SendParams.Add(requestParams);
|
||||||
|
XmlRpcRequest req = new XmlRpcRequest(method, SendParams);
|
||||||
|
if (!authenticationAddr.StartsWith("http://"))
|
||||||
|
authenticationAddr = "http://" + authenticationAddr;
|
||||||
|
return req.Send(authenticationAddr, 300000);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
static public UserProfileData HashtableToUserProfileData(Hashtable responseData)
|
||||||
|
{
|
||||||
|
UserProfileData profile = new UserProfileData();
|
||||||
|
// Account information
|
||||||
|
profile.username = (string)responseData["firstname"];
|
||||||
|
profile.surname = (string)responseData["lastname"];
|
||||||
|
|
||||||
|
profile.UUID = LLUUID.Parse((string)responseData["uuid"]);
|
||||||
|
// Server Information
|
||||||
|
profile.userInventoryURI = (string)responseData["server_inventory"];
|
||||||
|
profile.userAssetURI = (string)responseData["server_asset"];
|
||||||
|
// Profile Information
|
||||||
|
profile.profileAboutText = (string)responseData["profile_about"];
|
||||||
|
profile.profileFirstText = (string)responseData["profile_firstlife_about"];
|
||||||
|
profile.profileFirstImage = LLUUID.Parse((string)responseData["profile_firstlife_image"]);
|
||||||
|
|
||||||
|
profile.profileCanDoMask = uint.Parse((string)responseData["profile_can_do"]);
|
||||||
|
profile.profileWantDoMask = uint.Parse((string)responseData["profile_want_do"]);
|
||||||
|
|
||||||
|
profile.profileImage = LLUUID.Parse((string)responseData["profile_image"]);
|
||||||
|
|
||||||
|
profile.created = int.Parse((string)responseData["profile_created"]);
|
||||||
|
profile.lastLogin = int.Parse((string)responseData["profile_lastlogin"]);
|
||||||
|
// Home region information
|
||||||
|
profile.homeLocation = new LLVector3(float.Parse((string)responseData["home_coordinates_x"]),
|
||||||
|
float.Parse((string)responseData["home_coordinates_y"]),
|
||||||
|
float.Parse((string)responseData["home_coordinates_z"]));
|
||||||
|
|
||||||
|
profile.homeRegion = ulong.Parse((string)responseData["home_region"]);
|
||||||
|
|
||||||
|
profile.homeLookAt = new LLVector3(float.Parse((string)responseData["home_look_x"]),
|
||||||
|
float.Parse((string)responseData["home_look_y"]),
|
||||||
|
float.Parse((string)responseData["home_look_z"]));
|
||||||
|
|
||||||
|
Hashtable UADtable = (Hashtable)responseData["currentAgent"];
|
||||||
|
if (UADtable != null)
|
||||||
|
{
|
||||||
|
profile.currentAgent = new UserAgentData();
|
||||||
|
HashtableToAgentData(ref UADtable, ref profile.currentAgent);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
System.Console.WriteLine("No currentAgent in response!");
|
||||||
|
}
|
||||||
|
|
||||||
|
return profile;
|
||||||
|
}
|
||||||
|
|
||||||
|
static public void HashtableToAgentData(ref Hashtable h, ref UserAgentData uad)
|
||||||
|
{
|
||||||
|
|
||||||
|
uad.UUID = LLUUID.Parse((string)h["UUID"]);
|
||||||
|
|
||||||
|
uad.agentIP = (string)h["agentIP"];
|
||||||
|
|
||||||
|
uad.agentPort = uint.Parse((string)h["agentPort"]);
|
||||||
|
|
||||||
|
uad.agentOnline = Boolean.Parse((string)h["agentOnline"]);
|
||||||
|
|
||||||
|
uad.sessionID = LLUUID.Parse((string)h["sessionID"]);
|
||||||
|
|
||||||
|
uad.secureSessionID = LLUUID.Parse((string)h["secureSessionID"]);
|
||||||
|
|
||||||
|
uad.regionID = LLUUID.Parse((string)h["regionID"]);
|
||||||
|
|
||||||
|
uad.loginTime = int.Parse((string)h["loginTime"]);
|
||||||
|
|
||||||
|
uad.logoutTime = int.Parse((string)h["logoutTime"]);
|
||||||
|
|
||||||
|
uad.currentRegion = LLUUID.Parse((string)h["currentRegion"]);
|
||||||
|
|
||||||
|
uad.currentHandle = ulong.Parse((string)h["currentHandle"]);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string pos1 = (string)h["currentPos"];//<123,3132,3123>
|
||||||
|
string pos2 = pos1.Substring(1, pos1.Length - 2); // remove < & >
|
||||||
|
string[] vals = pos2.Split(',');
|
||||||
|
uad.currentPos = new LLVector3(float.Parse(vals[0]), float.Parse(vals[1]), float.Parse(vals[2]));
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
uad.currentPos = new LLVector3();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -44,6 +44,7 @@ namespace OpenSim.Framework.UserManagement
|
||||||
{
|
{
|
||||||
public UserConfig _config;
|
public UserConfig _config;
|
||||||
private Dictionary<string, IUserData> _plugins = new Dictionary<string, IUserData>();
|
private Dictionary<string, IUserData> _plugins = new Dictionary<string, IUserData>();
|
||||||
|
public bool RexMode = false; // _config is not initiated in local mode
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Adds a new user server plugin - user servers will be requested in the order they were loaded.
|
/// Adds a new user server plugin - user servers will be requested in the order they were loaded.
|
||||||
|
@ -88,22 +89,86 @@ namespace OpenSim.Framework.UserManagement
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="uuid">The target UUID</param>
|
/// <param name="uuid">The target UUID</param>
|
||||||
/// <returns>A user profile. Returns null if no user profile is found.</returns>
|
/// <returns>A user profile. Returns null if no user profile is found.</returns>
|
||||||
public UserProfileData GetUserProfile(LLUUID uuid)
|
public UserProfileData GetUserProfile(LLUUID uuid, string authAddr)
|
||||||
|
{
|
||||||
|
if (!RexMode)
|
||||||
{
|
{
|
||||||
foreach (KeyValuePair<string, IUserData> plugin in _plugins)
|
foreach (KeyValuePair<string, IUserData> plugin in _plugins)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
UserProfileData profile = plugin.Value.GetUserByUUID(uuid);
|
UserProfileData profile = plugin.Value.GetUserByUUID(uuid);
|
||||||
|
|
||||||
if (null != profile)
|
if (null != profile)
|
||||||
{
|
{
|
||||||
profile.currentAgent = getUserAgent(profile.UUID);
|
profile.currentAgent = getUserAgent(profile.UUID);
|
||||||
return profile;
|
return profile;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
MainLog.Instance.Verbose("USERSTORAGE", "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
UserProfileData userpd = null;
|
||||||
|
System.Collections.Hashtable param = new System.Collections.Hashtable();
|
||||||
|
param["avatar_uuid"] = uuid.ToString();
|
||||||
|
param["AuthenticationAddress"] = authAddr;
|
||||||
|
System.Collections.Hashtable resp = MakeCommonRequest("get_user_by_uuid", param, authAddr, 3000);
|
||||||
|
userpd = RexLoginHandler.HashtableToUserProfileData(resp);
|
||||||
|
return userpd;
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
System.Console.WriteLine("Error when trying to fetch profile data by uuid from remote authentication server: " +
|
||||||
|
e.Message);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public System.Collections.Hashtable MakeCommonRequest(string method, System.Collections.Hashtable param, string addr, int timeout)//rex
|
||||||
|
{
|
||||||
|
System.Collections.IList parameters = new System.Collections.ArrayList();
|
||||||
|
parameters.Add(param);
|
||||||
|
XmlRpcRequest req = new XmlRpcRequest(method, parameters);
|
||||||
|
if (!addr.StartsWith("http://"))
|
||||||
|
addr = "http://" + addr;
|
||||||
|
XmlRpcResponse resp = req.Send(addr, timeout);
|
||||||
|
return (System.Collections.Hashtable)resp.Value;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Loads a user profile by name
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="name">The target name</param>
|
||||||
|
/// <returns>A user profile</returns>
|
||||||
|
public UserProfileData GetUserProfileByAccount(string account)
|
||||||
|
{
|
||||||
|
foreach (KeyValuePair<string, IUserData> plugin in _plugins)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
UserProfileData profile = plugin.Value.GetUserByAccount(account);
|
||||||
|
profile.currentAgent = getUserAgent(profile.UUID);
|
||||||
|
return profile;
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
MainLog.Instance.Verbose("USERSTORAGE", "Unable to find user by account via " + plugin.Key + "(" + e.ToString() + ")");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public List<AvatarPickerAvatar> GenerateAgentPickerRequestResponse(LLUUID queryID, string query)
|
public List<AvatarPickerAvatar> GenerateAgentPickerRequestResponse(LLUUID queryID, string query)
|
||||||
{
|
{
|
||||||
List<AvatarPickerAvatar> pickerlist = new List<AvatarPickerAvatar>();
|
List<AvatarPickerAvatar> pickerlist = new List<AvatarPickerAvatar>();
|
||||||
|
@ -129,9 +194,13 @@ namespace OpenSim.Framework.UserManagement
|
||||||
/// <param name="fname">First name</param>
|
/// <param name="fname">First name</param>
|
||||||
/// <param name="lname">Last name</param>
|
/// <param name="lname">Last name</param>
|
||||||
/// <returns>A user profile. Returns null if no profile is found</returns>
|
/// <returns>A user profile. Returns null if no profile is found</returns>
|
||||||
public UserProfileData GetUserProfile(string fname, string lname)
|
public UserProfileData GetUserProfile(string fname, string lname, string authAddr)
|
||||||
|
{
|
||||||
|
if (!RexMode)
|
||||||
{
|
{
|
||||||
foreach (KeyValuePair<string, IUserData> plugin in _plugins)
|
foreach (KeyValuePair<string, IUserData> plugin in _plugins)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
UserProfileData profile = plugin.Value.GetUserByName(fname, lname);
|
UserProfileData profile = plugin.Value.GetUserByName(fname, lname);
|
||||||
|
|
||||||
|
@ -141,6 +210,37 @@ namespace OpenSim.Framework.UserManagement
|
||||||
return profile;
|
return profile;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
MainLog.Instance.Verbose("USERSTORAGE", "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
UserProfileData userpd = null;
|
||||||
|
System.Collections.Hashtable param = new System.Collections.Hashtable();
|
||||||
|
param["avatar_name"] = fname + " "+lname;
|
||||||
|
param["AuthenticationAddress"] = authAddr;
|
||||||
|
System.Collections.Hashtable resp = MakeCommonRequest("get_user_by_name", param, authAddr, 3000);
|
||||||
|
if (resp.Contains("error_type"))
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
userpd = RexLoginHandler.HashtableToUserProfileData(resp);
|
||||||
|
return userpd;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
System.Console.WriteLine("Error when trying to fetch profile data by firstname, lastname from remote authentication server: " +
|
||||||
|
e.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -295,13 +395,37 @@ namespace OpenSim.Framework.UserManagement
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: document
|
// TODO: document
|
||||||
public void clearUserAgent(LLUUID agentID)
|
public void clearUserAgent(LLUUID agentID, string authAddr)
|
||||||
|
{
|
||||||
|
UserProfileData profile = GetUserProfile(agentID, authAddr);
|
||||||
|
if (profile != null)
|
||||||
{
|
{
|
||||||
UserProfileData profile = GetUserProfile(agentID);
|
|
||||||
profile.currentAgent = null;
|
profile.currentAgent = null;
|
||||||
|
if (!RexMode)
|
||||||
|
{
|
||||||
setUserProfile(profile);
|
setUserProfile(profile);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
System.Collections.Hashtable param = new System.Collections.Hashtable();
|
||||||
|
param["agentID"] = profile.UUID.ToString();
|
||||||
|
System.Collections.Hashtable resp = MakeCommonRequest("remove_user_agent", param, authAddr, 3000);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
System.Console.WriteLine("Error when trying to fetch agent data by uuid from remote authentication server: " +
|
||||||
|
e.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MainLog.Instance.Verbose("USERSTORAGE", "Unable to clear user agent with agentID : " + agentID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Loads a user agent by name (not called directly)
|
/// Loads a user agent by name (not called directly)
|
||||||
|
@ -461,6 +585,7 @@ namespace OpenSim.Framework.UserManagement
|
||||||
user.homeRegionX = regX;
|
user.homeRegionX = regX;
|
||||||
user.homeRegionY = regY;
|
user.homeRegionY = regY;
|
||||||
|
|
||||||
|
|
||||||
foreach (KeyValuePair<string, IUserData> plugin in _plugins)
|
foreach (KeyValuePair<string, IUserData> plugin in _plugins)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
@ -480,5 +605,97 @@ namespace OpenSim.Framework.UserManagement
|
||||||
public abstract UserProfileData SetupMasterUser(string firstName, string lastName);
|
public abstract UserProfileData SetupMasterUser(string firstName, string lastName);
|
||||||
public abstract UserProfileData SetupMasterUser(string firstName, string lastName, string password);
|
public abstract UserProfileData SetupMasterUser(string firstName, string lastName, string password);
|
||||||
public abstract UserProfileData SetupMasterUser(LLUUID uuid);
|
public abstract UserProfileData SetupMasterUser(LLUUID uuid);
|
||||||
|
|
||||||
|
|
||||||
|
public bool AuthenticateUser(LLUUID agentId, string sessionhash, out String avatarstorage)
|
||||||
|
{
|
||||||
|
avatarstorage = "";
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Loads a user profile by name
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="name">The target name</param>
|
||||||
|
/// <returns>A user profile</returns>
|
||||||
|
public UserProfileData GetUserProfile(string name, string authAddr)
|
||||||
|
{
|
||||||
|
foreach (KeyValuePair<string, IUserData> plugin in _plugins)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
UserProfileData profile = plugin.Value.GetUserByName(name, authAddr);
|
||||||
|
profile.currentAgent = getUserAgent(profile.UUID);
|
||||||
|
return profile;
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
MainLog.Instance.Verbose("USERSTORAGE", "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void UpdateUserAgentData(LLUUID agentId, bool agentOnline, LLVector3 currentPos, int logoutTime, string authAddr)
|
||||||
|
{
|
||||||
|
// Saves the agent to database
|
||||||
|
//return true;
|
||||||
|
if (!RexMode)
|
||||||
|
{
|
||||||
|
foreach (KeyValuePair<string, IUserData> plugin in _plugins)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
UserAgentData agent = plugin.Value.GetAgentByUUID(agentId);
|
||||||
|
if (agent != null)
|
||||||
|
{
|
||||||
|
agent.agentOnline = agentOnline;
|
||||||
|
agent.logoutTime = logoutTime;
|
||||||
|
agent.currentPos = currentPos;
|
||||||
|
agent.currentPos = new LLVector3(
|
||||||
|
Convert.ToSingle(currentPos.X),
|
||||||
|
Convert.ToSingle(currentPos.Y),
|
||||||
|
Convert.ToSingle(currentPos.Z));
|
||||||
|
plugin.Value.AddNewUserAgent(agent);
|
||||||
|
MainLog.Instance.Verbose("USERSTORAGE", "Agent updated UUID = " + agent.UUID.ToString());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MainLog.Instance.Verbose("USERSTORAGE", "Agent update, agent not found with UUID = " + agentId);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
MainLog.Instance.Verbose("USERSTORAGE", "Unable to add or update agent via " + plugin.Key + "(" + e.ToString() + ")");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
System.Collections.Hashtable param = new System.Collections.Hashtable();
|
||||||
|
param["agentID"] = agentId.ToString();
|
||||||
|
param["agentOnline"] = agentOnline.ToString();
|
||||||
|
param["logoutTime"] = logoutTime.ToString();
|
||||||
|
param["agent_currentPosX"] = Convert.ToSingle(currentPos.X).ToString();
|
||||||
|
param["agent_currentPosY"] = Convert.ToSingle(currentPos.Y).ToString();
|
||||||
|
param["agent_currentPosZ"] = Convert.ToSingle(currentPos.Z).ToString();
|
||||||
|
param["AuthenticationAddress"] = authAddr;
|
||||||
|
System.Collections.Hashtable resp = MakeCommonRequest("update_user_agent", param, authAddr, 3000);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
System.Console.WriteLine("Error when trying to update user agent data to remote authentication server: " +
|
||||||
|
e.Message);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,6 +62,18 @@ namespace OpenSim.Framework.Data.DB4o
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Loads a specified user profile from a account
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="uuid">The users account</param>
|
||||||
|
/// <returns>A user profile</returns>
|
||||||
|
public UserProfileData GetUserByAccount(string account)
|
||||||
|
{
|
||||||
|
if (manager.userProfiles.ContainsKey(account))
|
||||||
|
return manager.userProfiles[account];
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns a user by searching for its name
|
/// Returns a user by searching for its name
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -92,9 +92,9 @@ namespace OpenSim.Framework.Data.MSSQL
|
||||||
|
|
||||||
SqlCommand cmd =
|
SqlCommand cmd =
|
||||||
new SqlCommand(
|
new SqlCommand(
|
||||||
"INSERT INTO assets ([id], [name], [description], [assetType], [invType], [local], [temporary], [data])" +
|
"INSERT INTO assets ([id], [name], [mediaUrl], [description], [assetType], [invType], [local], [temporary], [data])" +
|
||||||
" VALUES " +
|
" VALUES " +
|
||||||
"(@id, @name, @description, @assetType, @invType, @local, @temporary, @data)",
|
"(@id, @name, @mediaUrl, @description, @assetType, @invType, @local, @temporary, @data)",
|
||||||
database.getConnection());
|
database.getConnection());
|
||||||
|
|
||||||
using (cmd)
|
using (cmd)
|
||||||
|
@ -103,6 +103,7 @@ namespace OpenSim.Framework.Data.MSSQL
|
||||||
//p.Value = asset.FullID.ToString();
|
//p.Value = asset.FullID.ToString();
|
||||||
cmd.Parameters.AddWithValue("id", asset.FullID.ToString());
|
cmd.Parameters.AddWithValue("id", asset.FullID.ToString());
|
||||||
cmd.Parameters.AddWithValue("name", asset.Name);
|
cmd.Parameters.AddWithValue("name", asset.Name);
|
||||||
|
cmd.Parameters.AddWithValue("mediaUrl", asset.MediaURL);
|
||||||
cmd.Parameters.AddWithValue("description", asset.Description);
|
cmd.Parameters.AddWithValue("description", asset.Description);
|
||||||
SqlParameter e = cmd.Parameters.Add("assetType", SqlDbType.TinyInt);
|
SqlParameter e = cmd.Parameters.Add("assetType", SqlDbType.TinyInt);
|
||||||
e.Value = asset.Type;
|
e.Value = asset.Type;
|
||||||
|
@ -132,6 +133,7 @@ namespace OpenSim.Framework.Data.MSSQL
|
||||||
{
|
{
|
||||||
SqlCommand command = new SqlCommand("UPDATE assets set id = @id, " +
|
SqlCommand command = new SqlCommand("UPDATE assets set id = @id, " +
|
||||||
"name = @name, " +
|
"name = @name, " +
|
||||||
|
"mediaUrl = @mediaUrl, "+
|
||||||
"description = @description," +
|
"description = @description," +
|
||||||
"assetType = @assetType," +
|
"assetType = @assetType," +
|
||||||
"invType = @invType," +
|
"invType = @invType," +
|
||||||
|
@ -141,13 +143,14 @@ namespace OpenSim.Framework.Data.MSSQL
|
||||||
"id = @keyId;", database.getConnection());
|
"id = @keyId;", database.getConnection());
|
||||||
SqlParameter param1 = new SqlParameter("@id", asset.FullID.ToString());
|
SqlParameter param1 = new SqlParameter("@id", asset.FullID.ToString());
|
||||||
SqlParameter param2 = new SqlParameter("@name", asset.Name);
|
SqlParameter param2 = new SqlParameter("@name", asset.Name);
|
||||||
SqlParameter param3 = new SqlParameter("@description", asset.Description);
|
SqlParameter param3 = new SqlParameter("@mediaUrl", asset.MediaURL);
|
||||||
SqlParameter param4 = new SqlParameter("@assetType", asset.Type);
|
SqlParameter param4 = new SqlParameter("@description", asset.Description);
|
||||||
SqlParameter param5 = new SqlParameter("@invType", asset.InvType);
|
SqlParameter param5 = new SqlParameter("@assetType", Convert.ToBoolean(asset.Type));
|
||||||
SqlParameter param6 = new SqlParameter("@local", asset.Local);
|
SqlParameter param6 = new SqlParameter("@invType", Convert.ToBoolean(asset.InvType));
|
||||||
SqlParameter param7 = new SqlParameter("@temporary", asset.Temporary);
|
SqlParameter param7 = new SqlParameter("@local", asset.Local);
|
||||||
SqlParameter param8 = new SqlParameter("@data", asset.Data);
|
SqlParameter param8 = new SqlParameter("@temporary", asset.Temporary);
|
||||||
SqlParameter param9 = new SqlParameter("@keyId", asset.FullID.ToString());
|
SqlParameter param9 = new SqlParameter("@data", asset.Data);
|
||||||
|
SqlParameter param10 = new SqlParameter("@keyId", asset.FullID.ToString());
|
||||||
command.Parameters.Add(param1);
|
command.Parameters.Add(param1);
|
||||||
command.Parameters.Add(param2);
|
command.Parameters.Add(param2);
|
||||||
command.Parameters.Add(param3);
|
command.Parameters.Add(param3);
|
||||||
|
@ -157,6 +160,7 @@ namespace OpenSim.Framework.Data.MSSQL
|
||||||
command.Parameters.Add(param7);
|
command.Parameters.Add(param7);
|
||||||
command.Parameters.Add(param8);
|
command.Parameters.Add(param8);
|
||||||
command.Parameters.Add(param9);
|
command.Parameters.Add(param9);
|
||||||
|
command.Parameters.Add(param10);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -177,6 +181,14 @@ namespace OpenSim.Framework.Data.MSSQL
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// rex, new function, fixme not implemented
|
||||||
|
public List<AssetBase> GetAssetList(int vAssetType)
|
||||||
|
{
|
||||||
|
List<AssetBase> retvals = new List<AssetBase>();
|
||||||
|
return retvals;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// All writes are immediately commited to the database, so this is a no-op
|
/// All writes are immediately commited to the database, so this is a no-op
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -184,6 +196,14 @@ namespace OpenSim.Framework.Data.MSSQL
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// rex new function for "replace assets" functionality
|
||||||
|
// TODO: actual implementation by someone, should return LLUUID of an asset
|
||||||
|
// with matching type & name, or zero if not in DB
|
||||||
|
public LLUUID ExistsAsset(sbyte type, string name)
|
||||||
|
{
|
||||||
|
return LLUUID.Zero;
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region IPlugin Members
|
#region IPlugin Members
|
||||||
|
|
|
@ -70,6 +70,7 @@ namespace OpenSim.Framework.Data.MSSQL
|
||||||
password + ";";
|
password + ";";
|
||||||
dbcon = new SqlConnection(connectionString);
|
dbcon = new SqlConnection(connectionString);
|
||||||
TestTables(dbcon);
|
TestTables(dbcon);
|
||||||
|
//System.Threading.Thread.Sleep(3000);
|
||||||
dbcon.Open();
|
dbcon.Open();
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
@ -105,8 +106,9 @@ namespace OpenSim.Framework.Data.MSSQL
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
|
conn.Close();
|
||||||
conn.Open();
|
conn.Open();
|
||||||
cmd = Query("alter table users add column [webLoginKey] varchar(36) default NULL", new Dictionary<string, string>());
|
cmd = Query("alter table users add [webLoginKey] varchar(36) default NULL", new Dictionary<string, string>());
|
||||||
cmd.ExecuteNonQuery();
|
cmd.ExecuteNonQuery();
|
||||||
cmd.Dispose();
|
cmd.Dispose();
|
||||||
conn.Close();
|
conn.Close();
|
||||||
|
@ -452,6 +454,7 @@ namespace OpenSim.Framework.Data.MSSQL
|
||||||
asset = new AssetBase();
|
asset = new AssetBase();
|
||||||
asset.Data = (byte[]) reader["data"];
|
asset.Data = (byte[]) reader["data"];
|
||||||
asset.Description = (string) reader["description"];
|
asset.Description = (string) reader["description"];
|
||||||
|
asset.MediaURL = (string)reader["mediaUrl"];
|
||||||
asset.FullID = new LLUUID((string) reader["id"]);
|
asset.FullID = new LLUUID((string) reader["id"]);
|
||||||
asset.InvType = Convert.ToSByte(reader["invType"]);
|
asset.InvType = Convert.ToSByte(reader["invType"]);
|
||||||
asset.Local = Convert.ToBoolean(reader["local"]); // ((sbyte)reader["local"]) != 0 ? true : false;
|
asset.Local = Convert.ToBoolean(reader["local"]); // ((sbyte)reader["local"]) != 0 ? true : false;
|
||||||
|
|
|
@ -243,6 +243,48 @@ namespace OpenSim.Framework.Data.MSSQL
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Searches the database for a specified user profile by account
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="uuid">The account</param>
|
||||||
|
/// <returns>The users profile</returns>
|
||||||
|
public UserProfileData GetUserByAccount(string account)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
lock (database)
|
||||||
|
{
|
||||||
|
Dictionary<string, string> param = new Dictionary<string, string>();
|
||||||
|
param["account"] = account;
|
||||||
|
|
||||||
|
IDbCommand result = database.Query("SELECT * FROM users WHERE account = @account", param);
|
||||||
|
IDataReader reader = result.ExecuteReader();
|
||||||
|
|
||||||
|
UserProfileData row = database.readUserRow(reader);
|
||||||
|
|
||||||
|
reader.Close();
|
||||||
|
result.Dispose();
|
||||||
|
|
||||||
|
if (row != null)
|
||||||
|
{
|
||||||
|
UserAgentData agentData = GetAgentByUUID(row.UUID);
|
||||||
|
if (agentData != null)
|
||||||
|
{
|
||||||
|
row.currentAgent = agentData;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return row;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
database.Reconnect();
|
||||||
|
MainLog.Instance.Error(e.ToString());
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns a user session searching by name
|
/// Returns a user session searching by name
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -5,6 +5,7 @@ CREATE TABLE [assets] (
|
||||||
[id] [varchar](36) NOT NULL,
|
[id] [varchar](36) NOT NULL,
|
||||||
[name] [varchar](64) NOT NULL,
|
[name] [varchar](64) NOT NULL,
|
||||||
[description] [varchar](64) NOT NULL,
|
[description] [varchar](64) NOT NULL,
|
||||||
|
[mediaURL] [varchar](255) NOT NULL,
|
||||||
[assetType] [tinyint] NOT NULL,
|
[assetType] [tinyint] NOT NULL,
|
||||||
[invType] [tinyint] NOT NULL,
|
[invType] [tinyint] NOT NULL,
|
||||||
[local] [tinyint] NOT NULL,
|
[local] [tinyint] NOT NULL,
|
||||||
|
|
|
@ -138,6 +138,13 @@ namespace OpenSim.Framework.Data.MySQL
|
||||||
throw new Exception("The method or operation is not implemented.");
|
throw new Exception("The method or operation is not implemented.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// rex, new function, fixme not implemented
|
||||||
|
public List<AssetBase> GetAssetList(int vAssetType)
|
||||||
|
{
|
||||||
|
List<AssetBase> retvals = new List<AssetBase>();
|
||||||
|
return retvals;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// All writes are immediately commited to the database, so this is a no-op
|
/// All writes are immediately commited to the database, so this is a no-op
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -145,6 +152,14 @@ namespace OpenSim.Framework.Data.MySQL
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// rex new function for "replace assets" functionality
|
||||||
|
// TODO: actual implementation by someone, should return LLUUID of an asset
|
||||||
|
// with matching type & name, or zero if not in DB
|
||||||
|
public LLUUID ExistsAsset(sbyte type, string name)
|
||||||
|
{
|
||||||
|
return LLUUID.Zero;
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region IPlugin Members
|
#region IPlugin Members
|
||||||
|
|
|
@ -295,7 +295,8 @@ namespace OpenSim.Framework.Data.MySQL
|
||||||
retval.regionDataURI = (string) reader["regionDataURI"];
|
retval.regionDataURI = (string) reader["regionDataURI"];
|
||||||
retval.regionOnline = false; // Needs to be pinged before this can be set.
|
retval.regionOnline = false; // Needs to be pinged before this can be set.
|
||||||
retval.serverIP = (string) reader["serverIP"];
|
retval.serverIP = (string) reader["serverIP"];
|
||||||
retval.serverPort = (uint) reader["serverPort"];
|
retval.serverPort = uint.Parse(reader["serverPort"].ToString());
|
||||||
|
//retval.serverPort = (uint) reader["serverPort"]; // this caused exceptions
|
||||||
retval.serverURI = (string) reader["serverURI"];
|
retval.serverURI = (string) reader["serverURI"];
|
||||||
retval.httpPort = Convert.ToUInt32(reader["serverHttpPort"].ToString());
|
retval.httpPort = Convert.ToUInt32(reader["serverHttpPort"].ToString());
|
||||||
retval.remotingPort = Convert.ToUInt32(reader["serverRemotingPort"].ToString());
|
retval.remotingPort = Convert.ToUInt32(reader["serverRemotingPort"].ToString());
|
||||||
|
|
|
@ -446,6 +446,39 @@ namespace OpenSim.Framework.Data.MySQL
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Searches the database for a specified user profile by account
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="uuid">The account</param>
|
||||||
|
/// <returns>The users profile</returns>
|
||||||
|
public UserProfileData GetUserByAccount(string account)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
lock (database)
|
||||||
|
{
|
||||||
|
Dictionary<string, string> param = new Dictionary<string, string>();
|
||||||
|
param["?account"] = account;
|
||||||
|
|
||||||
|
IDbCommand result = database.Query("SELECT * FROM users WHERE account = ?account", param);
|
||||||
|
IDataReader reader = result.ExecuteReader();
|
||||||
|
|
||||||
|
UserProfileData row = database.readUserRow(reader);
|
||||||
|
|
||||||
|
reader.Close();
|
||||||
|
result.Dispose();
|
||||||
|
|
||||||
|
return row;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
database.Reconnect();
|
||||||
|
MainLog.Instance.Error(e.ToString());
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns a user session searching by name
|
/// Returns a user session searching by name
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -31,6 +31,7 @@ using System.Reflection;
|
||||||
using libsecondlife;
|
using libsecondlife;
|
||||||
using Mono.Data.SqliteClient;
|
using Mono.Data.SqliteClient;
|
||||||
using OpenSim.Framework.Console;
|
using OpenSim.Framework.Console;
|
||||||
|
using System.Collections.Generic; // rex added
|
||||||
|
|
||||||
namespace OpenSim.Framework.Data.SQLite
|
namespace OpenSim.Framework.Data.SQLite
|
||||||
{
|
{
|
||||||
|
@ -117,6 +118,24 @@ namespace OpenSim.Framework.Data.SQLite
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// rex new function for "replace assets" functionality
|
||||||
|
public LLUUID ExistsAsset(sbyte type, string name)
|
||||||
|
{
|
||||||
|
LLUUID retVal = LLUUID.Zero;
|
||||||
|
|
||||||
|
lock (ds)
|
||||||
|
{
|
||||||
|
string selectExp = "Type = '" + type.ToString() + "' AND Name = '" + name + "'";
|
||||||
|
DataRow[] match = ds.Tables["assets"].Select(selectExp);
|
||||||
|
if (match.Length > 0)
|
||||||
|
{
|
||||||
|
retVal = new LLUUID((String)match[0]["UUID"]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return retVal;
|
||||||
|
}
|
||||||
|
|
||||||
private void LogAssetLoad(AssetBase asset)
|
private void LogAssetLoad(AssetBase asset)
|
||||||
{
|
{
|
||||||
string temporary = asset.Temporary ? "Temporary" : "Stored";
|
string temporary = asset.Temporary ? "Temporary" : "Stored";
|
||||||
|
@ -134,6 +153,32 @@ namespace OpenSim.Framework.Data.SQLite
|
||||||
return (row != null);
|
return (row != null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// rex, new function
|
||||||
|
public List<AssetBase> GetAssetList(int vAssetType)
|
||||||
|
{
|
||||||
|
List<AssetBase> retvals = new List<AssetBase>();
|
||||||
|
lock (ds)
|
||||||
|
{
|
||||||
|
string selectExp = "InvType = '" + vAssetType.ToString() + "'";
|
||||||
|
DataRow[] allAssets = ds.Tables["assets"].Select(selectExp);
|
||||||
|
foreach (DataRow row in allAssets)
|
||||||
|
{
|
||||||
|
// Do not use buildAsset(row) because we don't want to return the asset.data - Tuco
|
||||||
|
AssetBase asset = new AssetBase();
|
||||||
|
asset.FullID = new LLUUID((String)row["UUID"]);
|
||||||
|
asset.Name = (String)row["Name"];
|
||||||
|
asset.Description = (String)row["Description"];
|
||||||
|
asset.Type = Convert.ToSByte(row["Type"]);
|
||||||
|
asset.InvType = Convert.ToSByte(row["InvType"]);
|
||||||
|
asset.Local = Convert.ToBoolean(row["Local"]);
|
||||||
|
asset.Temporary = Convert.ToBoolean(row["Temporary"]);
|
||||||
|
retvals.Add(asset);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return retvals;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public void DeleteAsset(LLUUID uuid)
|
public void DeleteAsset(LLUUID uuid)
|
||||||
{
|
{
|
||||||
lock (ds)
|
lock (ds)
|
||||||
|
@ -171,6 +216,7 @@ namespace OpenSim.Framework.Data.SQLite
|
||||||
createCol(assets, "UUID", typeof (String));
|
createCol(assets, "UUID", typeof (String));
|
||||||
createCol(assets, "Name", typeof (String));
|
createCol(assets, "Name", typeof (String));
|
||||||
createCol(assets, "Description", typeof (String));
|
createCol(assets, "Description", typeof (String));
|
||||||
|
createCol(assets, "MediaURL", typeof(String));//rex mediaurl
|
||||||
createCol(assets, "Type", typeof (Int32));
|
createCol(assets, "Type", typeof (Int32));
|
||||||
createCol(assets, "InvType", typeof (Int32));
|
createCol(assets, "InvType", typeof (Int32));
|
||||||
createCol(assets, "Local", typeof (Boolean));
|
createCol(assets, "Local", typeof (Boolean));
|
||||||
|
@ -199,6 +245,14 @@ namespace OpenSim.Framework.Data.SQLite
|
||||||
asset.FullID = new LLUUID((String) row["UUID"]);
|
asset.FullID = new LLUUID((String) row["UUID"]);
|
||||||
asset.Name = (String) row["Name"];
|
asset.Name = (String) row["Name"];
|
||||||
asset.Description = (String) row["Description"];
|
asset.Description = (String) row["Description"];
|
||||||
|
try
|
||||||
|
{
|
||||||
|
asset.MediaURL = (String) row["MediaURL"];//rex mediaurl
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
asset.MediaURL = ""; // fixme, the row returns null which can't be cast to string, happens with old dbs right now. - Tuco
|
||||||
|
}
|
||||||
asset.Type = Convert.ToSByte(row["Type"]);
|
asset.Type = Convert.ToSByte(row["Type"]);
|
||||||
asset.InvType = Convert.ToSByte(row["InvType"]);
|
asset.InvType = Convert.ToSByte(row["InvType"]);
|
||||||
asset.Local = Convert.ToBoolean(row["Local"]);
|
asset.Local = Convert.ToBoolean(row["Local"]);
|
||||||
|
@ -220,6 +274,15 @@ namespace OpenSim.Framework.Data.SQLite
|
||||||
{
|
{
|
||||||
row["Description"] = " ";
|
row["Description"] = " ";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (asset.MediaURL != null) //rex mediaurl
|
||||||
|
{
|
||||||
|
row["MediaURL"] = asset.MediaURL;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
row["MediaURL"] = " ";
|
||||||
|
}
|
||||||
row["Type"] = asset.Type;
|
row["Type"] = asset.Type;
|
||||||
row["InvType"] = asset.InvType;
|
row["InvType"] = asset.InvType;
|
||||||
row["Local"] = asset.Local;
|
row["Local"] = asset.Local;
|
||||||
|
|
|
@ -114,6 +114,33 @@ namespace OpenSim.Framework.Data.SQLite
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Loads a specified user profile from a account
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="account">The users account</param>
|
||||||
|
/// <returns>A user profile</returns>
|
||||||
|
public UserProfileData GetUserByAccount(string account)
|
||||||
|
{
|
||||||
|
lock (ds)
|
||||||
|
{
|
||||||
|
DataRow row = ds.Tables["users"].Rows.Find(account);
|
||||||
|
if (row != null)
|
||||||
|
{
|
||||||
|
UserProfileData user = buildUserProfile(row);
|
||||||
|
row = ds.Tables["useragents"].Rows.Find(user.UUID);
|
||||||
|
if (row != null)
|
||||||
|
{
|
||||||
|
user.currentAgent = buildUserAgent(row);
|
||||||
|
}
|
||||||
|
return user;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// see IUserData
|
// see IUserData
|
||||||
public UserProfileData GetUserByName(string fname, string lname)
|
public UserProfileData GetUserByName(string fname, string lname)
|
||||||
{
|
{
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using libsecondlife;
|
using libsecondlife;
|
||||||
|
using System.Collections.Generic; // rex added
|
||||||
|
|
||||||
namespace OpenSim.Framework
|
namespace OpenSim.Framework
|
||||||
{
|
{
|
||||||
|
@ -37,5 +38,7 @@ namespace OpenSim.Framework
|
||||||
void UpdateAsset(AssetBase asset);
|
void UpdateAsset(AssetBase asset);
|
||||||
bool ExistsAsset(LLUUID uuid);
|
bool ExistsAsset(LLUUID uuid);
|
||||||
void CommitAssets(); // force a sync to the database
|
void CommitAssets(); // force a sync to the database
|
||||||
|
LLUUID ExistsAsset(sbyte type, string name); // rex new function for "replace asset" functionality
|
||||||
|
List<AssetBase> GetAssetList(int vAssetType); // rex, added
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -41,6 +41,10 @@ namespace OpenSim.Framework
|
||||||
void UpdateAsset(AssetBase asset);
|
void UpdateAsset(AssetBase asset);
|
||||||
void StoreAndCommitAsset(AssetBase asset);
|
void StoreAndCommitAsset(AssetBase asset);
|
||||||
void Close();
|
void Close();
|
||||||
|
LLUUID ExistsAsset(sbyte type, string name); // rex new function for "replace asset" functionality
|
||||||
|
bool ExistsAsset(LLUUID assetID); // rex added
|
||||||
|
List<AssetBase> GetAssetList(int vAssetType); // rex added
|
||||||
|
AssetBase FetchAsset(LLUUID assetID); // rex added
|
||||||
}
|
}
|
||||||
|
|
||||||
// could change to delegate?
|
// could change to delegate?
|
||||||
|
|
|
@ -379,6 +379,9 @@ namespace OpenSim.Framework
|
||||||
public delegate void MoveInventoryItem(
|
public delegate void MoveInventoryItem(
|
||||||
IClientAPI remoteClient, LLUUID folderID, LLUUID itemID, int length, string newName);
|
IClientAPI remoteClient, LLUUID folderID, LLUUID itemID, int length, string newName);
|
||||||
|
|
||||||
|
public delegate void RemoveInventoryItem(
|
||||||
|
IClientAPI remoteClient, LLUUID itemID); // rex
|
||||||
|
|
||||||
public delegate void RezScript(IClientAPI remoteClient, LLUUID itemID, uint localID);
|
public delegate void RezScript(IClientAPI remoteClient, LLUUID itemID, uint localID);
|
||||||
|
|
||||||
public delegate void UpdateTaskInventory(IClientAPI remoteClient, LLUUID itemID, LLUUID folderID, uint localID);
|
public delegate void UpdateTaskInventory(IClientAPI remoteClient, LLUUID itemID, LLUUID folderID, uint localID);
|
||||||
|
@ -399,8 +402,22 @@ namespace OpenSim.Framework
|
||||||
|
|
||||||
public delegate void FriendshipTermination(IClientAPI remoteClient,LLUUID agentID, LLUUID ExID);
|
public delegate void FriendshipTermination(IClientAPI remoteClient,LLUUID agentID, LLUUID ExID);
|
||||||
|
|
||||||
|
public delegate void ReceiveRexClientScriptCmd(IClientAPI remoteClient,LLUUID agentID,List<string> vParams); // rex
|
||||||
|
|
||||||
|
//Attachments
|
||||||
|
public delegate void RezSingleAttachmentFromInv(IClientAPI remoteClient, LLUUID itemID, LLUUID ownerID,
|
||||||
|
uint itemFlags, byte attachPoint);
|
||||||
|
public delegate void ObjectAttach(IClientAPI remoteClient, uint localID, LLQuaternion rotation, byte attachPoint);
|
||||||
|
public delegate void ObjectDetach(IClientAPI remoteClient, uint localID);
|
||||||
|
|
||||||
|
|
||||||
|
// REX
|
||||||
|
public delegate void UpdateAssetMediaURL(IClientAPI remoteClient, LLUUID itemID, string mediaUrl);
|
||||||
|
|
||||||
|
// REX
|
||||||
|
public delegate void ObjectClickAction(IClientAPI remoteClient, uint objectLocalId, byte clickAction);
|
||||||
|
|
||||||
|
public delegate void TriggerSound(IClientAPI remoteClient, LLUUID soundID, LLUUID ownerID, LLUUID objectID, LLUUID parentID, ulong handle, LLVector3 position, float gain);
|
||||||
|
|
||||||
|
|
||||||
public delegate void ObjectPermissions(
|
public delegate void ObjectPermissions(
|
||||||
|
@ -476,6 +493,7 @@ namespace OpenSim.Framework
|
||||||
event UpdateInventoryItem OnUpdateInventoryItem;
|
event UpdateInventoryItem OnUpdateInventoryItem;
|
||||||
event CopyInventoryItem OnCopyInventoryItem;
|
event CopyInventoryItem OnCopyInventoryItem;
|
||||||
event MoveInventoryItem OnMoveInventoryItem;
|
event MoveInventoryItem OnMoveInventoryItem;
|
||||||
|
event RemoveInventoryItem OnRemoveInventoryItem; // rex
|
||||||
event UDPAssetUploadRequest OnAssetUploadRequest;
|
event UDPAssetUploadRequest OnAssetUploadRequest;
|
||||||
event XferReceive OnXferReceive;
|
event XferReceive OnXferReceive;
|
||||||
event RequestXfer OnRequestXfer;
|
event RequestXfer OnRequestXfer;
|
||||||
|
@ -484,6 +502,10 @@ namespace OpenSim.Framework
|
||||||
event UpdateTaskInventory OnUpdateTaskInventory;
|
event UpdateTaskInventory OnUpdateTaskInventory;
|
||||||
event RemoveTaskInventory OnRemoveTaskItem;
|
event RemoveTaskInventory OnRemoveTaskItem;
|
||||||
|
|
||||||
|
event RezSingleAttachmentFromInv OnRezSingleAttachmentFromInv;
|
||||||
|
event ObjectAttach OnObjectAttach;
|
||||||
|
event ObjectDetach OnObjectDetach;
|
||||||
|
|
||||||
event UUIDNameRequest OnNameFromUUIDRequest;
|
event UUIDNameRequest OnNameFromUUIDRequest;
|
||||||
|
|
||||||
event ParcelAccessListRequest OnParcelAccessListRequest;
|
event ParcelAccessListRequest OnParcelAccessListRequest;
|
||||||
|
@ -502,6 +524,10 @@ namespace OpenSim.Framework
|
||||||
event FriendActionDelegate OnDenyFriendRequest;
|
event FriendActionDelegate OnDenyFriendRequest;
|
||||||
event FriendshipTermination OnTerminateFriendship;
|
event FriendshipTermination OnTerminateFriendship;
|
||||||
|
|
||||||
|
event ReceiveRexClientScriptCmd OnReceiveRexClientScriptCmd; // rex
|
||||||
|
event ObjectClickAction OnObjectClickAction; // rex
|
||||||
|
event UpdateAssetMediaURL OnUpdateAssetMediaURL; // rex
|
||||||
|
event TriggerSound OnTriggerSound;
|
||||||
|
|
||||||
LLVector3 StartPos { get; set; }
|
LLVector3 StartPos { get; set; }
|
||||||
|
|
||||||
|
@ -527,6 +553,8 @@ namespace OpenSim.Framework
|
||||||
void OutPacket(Packet newPack, ThrottleOutPacketType packType);
|
void OutPacket(Packet newPack, ThrottleOutPacketType packType);
|
||||||
void SendWearables(AvatarWearable[] wearables, int serial);
|
void SendWearables(AvatarWearable[] wearables, int serial);
|
||||||
void SendAppearance(LLUUID agentID, byte[] visualParams, byte[] textureEntry);
|
void SendAppearance(LLUUID agentID, byte[] visualParams, byte[] textureEntry);
|
||||||
|
void SendRexAppearance(LLUUID agentID, string avatarAddress); // rex
|
||||||
|
void SendRexScriptCommand(string vUnit,string vCommand, string vCmdParams); // rex
|
||||||
void SendStartPingCheck(byte seq);
|
void SendStartPingCheck(byte seq);
|
||||||
void SendKillObject(ulong regionHandle, uint localID);
|
void SendKillObject(ulong regionHandle, uint localID);
|
||||||
void SendAnimations(LLUUID[] animID, int[] seqs, LLUUID sourceAgentId);
|
void SendAnimations(LLUUID[] animID, int[] seqs, LLUUID sourceAgentId);
|
||||||
|
@ -539,6 +567,9 @@ namespace OpenSim.Framework
|
||||||
|
|
||||||
void SendLayerData(float[] map);
|
void SendLayerData(float[] map);
|
||||||
void SendLayerData(int px, int py, float[] map);
|
void SendLayerData(int px, int py, float[] map);
|
||||||
|
|
||||||
|
void SendMediaURL(LLUUID assetId, string mediaURL); //rex
|
||||||
|
|
||||||
void MoveAgentIntoRegion(RegionInfo regInfo, LLVector3 pos, LLVector3 look);
|
void MoveAgentIntoRegion(RegionInfo regInfo, LLVector3 pos, LLVector3 look);
|
||||||
void InformClientOfNeighbour(ulong neighbourHandle, IPEndPoint neighbourExternalEndPoint);
|
void InformClientOfNeighbour(ulong neighbourHandle, IPEndPoint neighbourExternalEndPoint);
|
||||||
AgentCircuitData RequestClientInfo();
|
AgentCircuitData RequestClientInfo();
|
||||||
|
@ -596,12 +627,14 @@ namespace OpenSim.Framework
|
||||||
|
|
||||||
void SendPreLoadSound(LLUUID objectID, LLUUID ownerID, LLUUID soundID);
|
void SendPreLoadSound(LLUUID objectID, LLUUID ownerID, LLUUID soundID);
|
||||||
void SendPlayAttachedSound(LLUUID soundID, LLUUID objectID, LLUUID ownerID, float gain, byte flags);
|
void SendPlayAttachedSound(LLUUID soundID, LLUUID objectID, LLUUID ownerID, float gain, byte flags);
|
||||||
|
void SendTriggeredSound(LLUUID soundID, LLUUID ownerID, LLUUID objectID, LLUUID parentID, ulong handle, LLVector3 position, float gain);
|
||||||
|
|
||||||
void SendNameReply(LLUUID profileId, string firstname, string lastname);
|
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);
|
||||||
void SendLoadURL(string objectname, LLUUID objectID, LLUUID ownerID, bool groupOwned, string message, string url);
|
void SendLoadURL(string objectname, LLUUID objectID, LLUUID ownerID, bool groupOwned, string message, string url);
|
||||||
|
void SendDialog(string objectname, LLUUID objectID, LLUUID ownerID, string msg, LLUUID textureID, int ch, string[] buttonlabels);
|
||||||
bool AddMoney(int debit);
|
bool AddMoney(int debit);
|
||||||
|
|
||||||
void SendSunPos(LLVector3 sunPos, LLVector3 sunVel);
|
void SendSunPos(LLVector3 sunPos, LLVector3 sunVel);
|
||||||
|
@ -610,6 +643,8 @@ namespace OpenSim.Framework
|
||||||
void SendAvatarProperties(LLUUID avatarID, string aboutText, string bornOn, string charterMember, string flAbout,
|
void SendAvatarProperties(LLUUID avatarID, string aboutText, string bornOn, string charterMember, string flAbout,
|
||||||
uint flags, LLUUID flImageID, LLUUID imageID, string profileURL, LLUUID partnerID);
|
uint flags, LLUUID flImageID, LLUUID imageID, string profileURL, LLUUID partnerID);
|
||||||
|
|
||||||
|
void SendScriptTeleportRequest(string objectName, string simName, LLVector3 simPosition, LLVector3 lookAt);
|
||||||
|
|
||||||
void SetDebug(int newDebug);
|
void SetDebug(int newDebug);
|
||||||
void InPacket(Packet NewPack);
|
void InPacket(Packet NewPack);
|
||||||
void Close(bool ShutdownCircuit);
|
void Close(bool ShutdownCircuit);
|
||||||
|
|
|
@ -47,6 +47,7 @@ namespace OpenSim.Framework
|
||||||
|
|
||||||
void AddNewClient(IClientAPI client, bool child);
|
void AddNewClient(IClientAPI client, bool child);
|
||||||
void RemoveClient(LLUUID agentID);
|
void RemoveClient(LLUUID agentID);
|
||||||
|
void RemoveClient(LLUUID agentID, uint circuitCode);
|
||||||
void CloseAllAgents(uint circuitcode);
|
void CloseAllAgents(uint circuitcode);
|
||||||
|
|
||||||
void Restart(int seconds);
|
void Restart(int seconds);
|
||||||
|
@ -60,5 +61,7 @@ namespace OpenSim.Framework
|
||||||
RegionStatus Region_Status { get; set; }
|
RegionStatus Region_Status { get; set; }
|
||||||
|
|
||||||
ClientManager ClientManager { get; }
|
ClientManager ClientManager { get; }
|
||||||
|
|
||||||
|
bool RexMode { get; set; }//rex
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -42,6 +42,13 @@ namespace OpenSim.Framework
|
||||||
/// <returns>The user data profile. Returns null if no user is found</returns>
|
/// <returns>The user data profile. Returns null if no user is found</returns>
|
||||||
UserProfileData GetUserByUUID(LLUUID user);
|
UserProfileData GetUserByUUID(LLUUID user);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns a user profile from a database via their account
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="account">The account</param>
|
||||||
|
/// <returns>The user data profile</returns>
|
||||||
|
UserProfileData GetUserByAccount(string account);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns a users profile by searching their username parts
|
/// Returns a users profile by searching their username parts
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -32,16 +32,23 @@ namespace OpenSim.Framework
|
||||||
{
|
{
|
||||||
public interface IUserService
|
public interface IUserService
|
||||||
{
|
{
|
||||||
UserProfileData GetUserProfile(string firstName, string lastName);
|
UserProfileData GetUserProfile(string firstName, string lastName, string authAddr);
|
||||||
|
UserProfileData GetUserProfile(string firstName, string authAddr); // must differentiate this from GetUserProfile call
|
||||||
//UserProfileData GetUserProfile(string name);
|
//UserProfileData GetUserProfile(string name);
|
||||||
UserProfileData GetUserProfile(LLUUID userId);
|
UserProfileData GetUserProfileByAccount(string account);
|
||||||
void clearUserAgent(LLUUID avatarID);
|
UserProfileData GetUserProfile(LLUUID userId, string authAddr);
|
||||||
|
void clearUserAgent(LLUUID avatarID, string authAddr);
|
||||||
|
void UpdateUserAgentData(LLUUID agentId, bool agentOnline, LLVector3 currentPos, int logoutTime, string authAddr);
|
||||||
|
|
||||||
|
|
||||||
List<AvatarPickerAvatar> GenerateAgentPickerRequestResponse(LLUUID QueryID, string Query);
|
List<AvatarPickerAvatar> GenerateAgentPickerRequestResponse(LLUUID QueryID, string Query);
|
||||||
|
|
||||||
UserProfileData SetupMasterUser(string firstName, string lastName);
|
UserProfileData SetupMasterUser(string firstName, string lastName);
|
||||||
UserProfileData SetupMasterUser(string firstName, string lastName, string password);
|
UserProfileData SetupMasterUser(string firstName, string lastName, string password);
|
||||||
UserProfileData SetupMasterUser(LLUUID userId);
|
UserProfileData SetupMasterUser(LLUUID userId);
|
||||||
|
|
||||||
|
bool AuthenticateUser(LLUUID agentID, string sessionhash, out string asAddress);//rex
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -33,6 +33,7 @@ namespace OpenSim.Framework
|
||||||
{
|
{
|
||||||
public string First = "Test";
|
public string First = "Test";
|
||||||
public string Last = "User";
|
public string Last = "User";
|
||||||
|
public string ClientVersion = "not set"; //rex
|
||||||
public LLUUID Agent;
|
public LLUUID Agent;
|
||||||
public LLUUID Session;
|
public LLUUID Session;
|
||||||
public LLUUID SecureSession = LLUUID.Zero;
|
public LLUUID SecureSession = LLUUID.Zero;
|
||||||
|
@ -42,6 +43,10 @@ namespace OpenSim.Framework
|
||||||
public string CapsPath = "";
|
public string CapsPath = "";
|
||||||
public LLVector3 StartPos;
|
public LLVector3 StartPos;
|
||||||
|
|
||||||
|
public string AuthAddr = "";
|
||||||
|
public string asAddress = "";
|
||||||
|
|
||||||
|
|
||||||
public Login()
|
public Login()
|
||||||
{
|
{
|
||||||
StartPos = new LLVector3(128, 128, 70);
|
StartPos = new LLVector3(128, 128, 70);
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
namespace OpenSim.Framework
|
||||||
|
{
|
||||||
|
public class Pair<T1, T2>
|
||||||
|
{
|
||||||
|
public Pair(T1 t1, T2 t2)
|
||||||
|
{
|
||||||
|
First = t1;
|
||||||
|
Second = t2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public T1 First;
|
||||||
|
public T2 Second;
|
||||||
|
}
|
||||||
|
}
|
|
@ -227,17 +227,5 @@ namespace OpenSim.Framework
|
||||||
|
|
||||||
return shape;
|
return shape;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetPathRange( LLVector3 pathRange )
|
|
||||||
{
|
|
||||||
PathBegin = LLObject.PackBeginCut(pathRange.X);
|
|
||||||
PathEnd = LLObject.PackEndCut(pathRange.Y);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SetProfileRange( LLVector3 profileRange )
|
|
||||||
{
|
|
||||||
ProfileBegin = LLObject.PackBeginCut(profileRange.X);
|
|
||||||
ProfileEnd = LLObject.PackEndCut(profileRange.Y);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,123 @@
|
||||||
|
using System;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace OpenSim.Framework
|
||||||
|
{
|
||||||
|
public class PrioritizedQueue<T>
|
||||||
|
{
|
||||||
|
public delegate void AppendDelegate(LinkedList<Pair<T, int>> list, T item, int priority);
|
||||||
|
public delegate int DeterminePriorityDelegate(T item);
|
||||||
|
|
||||||
|
public AppendDelegate Appender { set { Append = value; } get { return Append; } }
|
||||||
|
private AppendDelegate Append;
|
||||||
|
|
||||||
|
DeterminePriorityDelegate DeterminePriority;
|
||||||
|
public DeterminePriorityDelegate PriorityDeterminer
|
||||||
|
{
|
||||||
|
set { DeterminePriority = value; }
|
||||||
|
get { return DeterminePriority; }
|
||||||
|
}
|
||||||
|
|
||||||
|
private LinkedList<Pair<T, int>> List;
|
||||||
|
private object _queueSync = new object();
|
||||||
|
|
||||||
|
public PrioritizedQueue()
|
||||||
|
{
|
||||||
|
Append = new AppendDelegate(this.DefaultAppend);
|
||||||
|
List = new LinkedList<Pair<T, int>>();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Enqueues the given item and uses DeterminePriority to determine priority
|
||||||
|
/// </summary>
|
||||||
|
public void Enqueue(T item)
|
||||||
|
{
|
||||||
|
Enqueue(item, DeterminePriority(item));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Enqueues the given item with given priority
|
||||||
|
/// </summary>
|
||||||
|
public void Enqueue(T item, int priority)
|
||||||
|
{
|
||||||
|
lock (_queueSync)
|
||||||
|
{
|
||||||
|
Append(List, item, priority);
|
||||||
|
Monitor.Pulse(_queueSync);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Enqueues the given item with given priority
|
||||||
|
/// </summary>
|
||||||
|
public void AddFirst(T item, int priority)
|
||||||
|
{
|
||||||
|
lock (_queueSync)
|
||||||
|
{
|
||||||
|
List.AddFirst(new Pair<T, int>(item, priority));
|
||||||
|
Monitor.Pulse(_queueSync);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Dequeues an item from the queue
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// Blocks until an item is available for dequeueing
|
||||||
|
/// </remarks>
|
||||||
|
public T Dequeue()
|
||||||
|
{
|
||||||
|
lock (_queueSync)
|
||||||
|
{
|
||||||
|
if (List.First == null)
|
||||||
|
{
|
||||||
|
Monitor.Wait(_queueSync);
|
||||||
|
}
|
||||||
|
|
||||||
|
T item = List.First.Value.First;
|
||||||
|
List.RemoveFirst();
|
||||||
|
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public int Count()
|
||||||
|
{
|
||||||
|
return List.Count;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool HasQueuedItems()
|
||||||
|
{
|
||||||
|
return (List.First != null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Default appending implementation
|
||||||
|
/// </summary>
|
||||||
|
private void DefaultAppend(LinkedList<Pair<T, int>> list, T item, int priority)
|
||||||
|
{
|
||||||
|
LinkedListNode<Pair<T, int>> node = list.Last;
|
||||||
|
|
||||||
|
if (node == null)
|
||||||
|
{
|
||||||
|
list.AddFirst(new Pair<T, int>(item, priority));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
while (node.Value.Second < priority)
|
||||||
|
{
|
||||||
|
node.Value.Second++;
|
||||||
|
|
||||||
|
node = node.Previous;
|
||||||
|
if (node == null)
|
||||||
|
{
|
||||||
|
list.AddFirst(new Pair<T, int>(item, priority));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
list.AddAfter(node, new Pair<T, int>(item, priority));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -169,6 +169,13 @@ namespace OpenSim.Framework
|
||||||
public string MasterAvatarLastName = "";
|
public string MasterAvatarLastName = "";
|
||||||
public string MasterAvatarSandboxPassword = "";
|
public string MasterAvatarSandboxPassword = "";
|
||||||
|
|
||||||
|
public LLUUID SkyboxFront = null;
|
||||||
|
public LLUUID SkyboxBack = null;
|
||||||
|
public LLUUID SkyboxLeft = null;
|
||||||
|
public LLUUID SkyboxRight = null;
|
||||||
|
public LLUUID SkyboxTop = null;
|
||||||
|
public LLUUID SkyboxBottom = null;
|
||||||
|
|
||||||
// Apparently, we're applying the same estatesettings regardless of whether it's local or remote.
|
// Apparently, we're applying the same estatesettings regardless of whether it's local or remote.
|
||||||
private static EstateSettings m_estateSettings;
|
private static EstateSettings m_estateSettings;
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,35 @@
|
||||||
|
// Rex, new file
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using libsecondlife;
|
||||||
|
|
||||||
|
namespace OpenSim.Framework
|
||||||
|
{
|
||||||
|
// Interface for script engine.
|
||||||
|
public interface RexScriptAccessInterface
|
||||||
|
{
|
||||||
|
bool GetAvatarStartLocation(out LLVector3 vLoc, out LLVector3 vLookAt);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Static class used for getting values from the script to server .net code.
|
||||||
|
// At the moment supports only one engine -> static.
|
||||||
|
public class RexScriptAccess
|
||||||
|
{
|
||||||
|
public static RexScriptAccessInterface MyScriptAccess = null;
|
||||||
|
|
||||||
|
public static bool GetAvatarStartLocation(out LLVector3 vLoc, out LLVector3 vLookAt)
|
||||||
|
{
|
||||||
|
vLoc = new LLVector3(0,0,0);
|
||||||
|
vLookAt = new LLVector3(0, 0, 0);
|
||||||
|
|
||||||
|
if (MyScriptAccess != null)
|
||||||
|
return MyScriptAccess.GetAvatarStartLocation(out vLoc, out vLookAt);
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,77 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Web;
|
||||||
|
|
||||||
|
namespace OpenSim.Framework.ServerStatus
|
||||||
|
{
|
||||||
|
public class ServerStatus
|
||||||
|
{
|
||||||
|
static StatusWindow m_window = null;
|
||||||
|
static Thread m_thread = null;
|
||||||
|
|
||||||
|
static public void ReportOutPacketUdp(int size, bool resent)
|
||||||
|
{
|
||||||
|
StatusWindow.ReportOutPacketUdp(size, resent);
|
||||||
|
}
|
||||||
|
|
||||||
|
static public void ReportInPacketUdp(int size)
|
||||||
|
{
|
||||||
|
StatusWindow.ReportInPacketUdp(size);
|
||||||
|
}
|
||||||
|
|
||||||
|
static public void ReportOutPacketTcp(int size)
|
||||||
|
{
|
||||||
|
StatusWindow.ReportOutPacketTcp(size);
|
||||||
|
}
|
||||||
|
|
||||||
|
static public void ReportInPacketTcp(int size)
|
||||||
|
{
|
||||||
|
StatusWindow.ReportInPacketTcp(size);
|
||||||
|
}
|
||||||
|
|
||||||
|
static public void ReportProcessedInPacket(string name, int size)
|
||||||
|
{
|
||||||
|
if (m_window != null)
|
||||||
|
StatusWindow.ReportProcessedInPacket(name, size);
|
||||||
|
}
|
||||||
|
|
||||||
|
static public void ReportProcessedOutPacket(string name, int size, bool resent)
|
||||||
|
{
|
||||||
|
if (m_window != null)
|
||||||
|
StatusWindow.ReportProcessedOutPacket(name, size, resent);
|
||||||
|
}
|
||||||
|
|
||||||
|
static public void ReportThreadName(string name)
|
||||||
|
{
|
||||||
|
StatusWindow.ReportThreadName(AppDomain.GetCurrentThreadId(), name);
|
||||||
|
}
|
||||||
|
|
||||||
|
static public void ShowWindow()
|
||||||
|
{
|
||||||
|
if (m_window == null)
|
||||||
|
{
|
||||||
|
m_window = new StatusWindow();
|
||||||
|
|
||||||
|
m_thread = new Thread(new ThreadStart(run));
|
||||||
|
m_thread.IsBackground = true;
|
||||||
|
m_thread.Start();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_window.Show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void run()
|
||||||
|
{
|
||||||
|
ReportThreadName("ServerStatus");
|
||||||
|
m_window.ShowDialog();
|
||||||
|
m_window.CloseStatusWindow();
|
||||||
|
m_window = null;
|
||||||
|
m_thread = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,514 @@
|
||||||
|
namespace OpenSim.Framework.ServerStatus
|
||||||
|
{
|
||||||
|
partial class StatusWindow
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
this.panel1 = new System.Windows.Forms.Panel();
|
||||||
|
this.tabControl1 = new System.Windows.Forms.TabControl();
|
||||||
|
this.tabThreads = new System.Windows.Forms.TabPage();
|
||||||
|
this.tabNetwork = new System.Windows.Forms.TabPage();
|
||||||
|
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
|
||||||
|
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
||||||
|
this.groupBox4 = new System.Windows.Forms.GroupBox();
|
||||||
|
this.m_outTotalTraffic = new System.Windows.Forms.Label();
|
||||||
|
this.m_inTotalTraffic = new System.Windows.Forms.Label();
|
||||||
|
this.label11 = new System.Windows.Forms.Label();
|
||||||
|
this.label12 = new System.Windows.Forms.Label();
|
||||||
|
this.groupBox3 = new System.Windows.Forms.GroupBox();
|
||||||
|
this.m_outTcpTraffic = new System.Windows.Forms.Label();
|
||||||
|
this.m_inTcpTraffic = new System.Windows.Forms.Label();
|
||||||
|
this.label7 = new System.Windows.Forms.Label();
|
||||||
|
this.label8 = new System.Windows.Forms.Label();
|
||||||
|
this.groupBox2 = new System.Windows.Forms.GroupBox();
|
||||||
|
this.m_outUdpTraffic = new System.Windows.Forms.Label();
|
||||||
|
this.m_inUdpTraffic = new System.Windows.Forms.Label();
|
||||||
|
this.label2 = new System.Windows.Forms.Label();
|
||||||
|
this.label1 = new System.Windows.Forms.Label();
|
||||||
|
this.m_networkDrawing = new System.Windows.Forms.PictureBox();
|
||||||
|
this.tabMemory = new System.Windows.Forms.TabPage();
|
||||||
|
this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel();
|
||||||
|
this.m_memStats = new System.Windows.Forms.PictureBox();
|
||||||
|
this.groupBox5 = new System.Windows.Forms.GroupBox();
|
||||||
|
this.m_availableMem = new System.Windows.Forms.Label();
|
||||||
|
this.m_commitSize = new System.Windows.Forms.Label();
|
||||||
|
this.label4 = new System.Windows.Forms.Label();
|
||||||
|
this.label3 = new System.Windows.Forms.Label();
|
||||||
|
this.tabCpu = new System.Windows.Forms.TabPage();
|
||||||
|
this.tableLayoutPanel3 = new System.Windows.Forms.TableLayoutPanel();
|
||||||
|
this.m_cpuDrawing = new System.Windows.Forms.PictureBox();
|
||||||
|
this.tabPackets = new System.Windows.Forms.TabPage();
|
||||||
|
this.panel1.SuspendLayout();
|
||||||
|
this.tabControl1.SuspendLayout();
|
||||||
|
this.tabNetwork.SuspendLayout();
|
||||||
|
this.tableLayoutPanel1.SuspendLayout();
|
||||||
|
this.groupBox1.SuspendLayout();
|
||||||
|
this.groupBox4.SuspendLayout();
|
||||||
|
this.groupBox3.SuspendLayout();
|
||||||
|
this.groupBox2.SuspendLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.m_networkDrawing)).BeginInit();
|
||||||
|
this.tabMemory.SuspendLayout();
|
||||||
|
this.tableLayoutPanel2.SuspendLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.m_memStats)).BeginInit();
|
||||||
|
this.groupBox5.SuspendLayout();
|
||||||
|
this.tabCpu.SuspendLayout();
|
||||||
|
this.tableLayoutPanel3.SuspendLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.m_cpuDrawing)).BeginInit();
|
||||||
|
this.SuspendLayout();
|
||||||
|
//
|
||||||
|
// panel1
|
||||||
|
//
|
||||||
|
this.panel1.Controls.Add(this.tabControl1);
|
||||||
|
this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
|
this.panel1.Location = new System.Drawing.Point(0, 0);
|
||||||
|
this.panel1.Name = "panel1";
|
||||||
|
this.panel1.Size = new System.Drawing.Size(604, 550);
|
||||||
|
this.panel1.TabIndex = 0;
|
||||||
|
//
|
||||||
|
// tabControl1
|
||||||
|
//
|
||||||
|
this.tabControl1.Controls.Add(this.tabThreads);
|
||||||
|
this.tabControl1.Controls.Add(this.tabNetwork);
|
||||||
|
this.tabControl1.Controls.Add(this.tabMemory);
|
||||||
|
this.tabControl1.Controls.Add(this.tabCpu);
|
||||||
|
this.tabControl1.Controls.Add(this.tabPackets);
|
||||||
|
this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
|
this.tabControl1.Location = new System.Drawing.Point(0, 0);
|
||||||
|
this.tabControl1.Name = "tabControl1";
|
||||||
|
this.tabControl1.SelectedIndex = 0;
|
||||||
|
this.tabControl1.Size = new System.Drawing.Size(604, 550);
|
||||||
|
this.tabControl1.TabIndex = 0;
|
||||||
|
//
|
||||||
|
// tabThreads
|
||||||
|
//
|
||||||
|
this.tabThreads.Location = new System.Drawing.Point(4, 22);
|
||||||
|
this.tabThreads.Name = "tabThreads";
|
||||||
|
this.tabThreads.Padding = new System.Windows.Forms.Padding(3);
|
||||||
|
this.tabThreads.Size = new System.Drawing.Size(596, 524);
|
||||||
|
this.tabThreads.TabIndex = 0;
|
||||||
|
this.tabThreads.Text = "Threads";
|
||||||
|
this.tabThreads.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// tabNetwork
|
||||||
|
//
|
||||||
|
this.tabNetwork.Controls.Add(this.tableLayoutPanel1);
|
||||||
|
this.tabNetwork.Location = new System.Drawing.Point(4, 22);
|
||||||
|
this.tabNetwork.Name = "tabNetwork";
|
||||||
|
this.tabNetwork.Padding = new System.Windows.Forms.Padding(3);
|
||||||
|
this.tabNetwork.Size = new System.Drawing.Size(596, 524);
|
||||||
|
this.tabNetwork.TabIndex = 1;
|
||||||
|
this.tabNetwork.Text = "Network";
|
||||||
|
this.tabNetwork.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// tableLayoutPanel1
|
||||||
|
//
|
||||||
|
this.tableLayoutPanel1.ColumnCount = 1;
|
||||||
|
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
|
||||||
|
this.tableLayoutPanel1.Controls.Add(this.groupBox1, 0, 1);
|
||||||
|
this.tableLayoutPanel1.Controls.Add(this.m_networkDrawing, 0, 0);
|
||||||
|
this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
|
this.tableLayoutPanel1.Location = new System.Drawing.Point(3, 3);
|
||||||
|
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
|
||||||
|
this.tableLayoutPanel1.RowCount = 2;
|
||||||
|
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
|
||||||
|
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 94F));
|
||||||
|
this.tableLayoutPanel1.Size = new System.Drawing.Size(590, 518);
|
||||||
|
this.tableLayoutPanel1.TabIndex = 0;
|
||||||
|
//
|
||||||
|
// groupBox1
|
||||||
|
//
|
||||||
|
this.groupBox1.Controls.Add(this.groupBox4);
|
||||||
|
this.groupBox1.Controls.Add(this.groupBox3);
|
||||||
|
this.groupBox1.Controls.Add(this.groupBox2);
|
||||||
|
this.groupBox1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
|
this.groupBox1.Location = new System.Drawing.Point(3, 427);
|
||||||
|
this.groupBox1.Name = "groupBox1";
|
||||||
|
this.groupBox1.Size = new System.Drawing.Size(584, 88);
|
||||||
|
this.groupBox1.TabIndex = 0;
|
||||||
|
this.groupBox1.TabStop = false;
|
||||||
|
this.groupBox1.Text = "Traffic";
|
||||||
|
//
|
||||||
|
// groupBox4
|
||||||
|
//
|
||||||
|
this.groupBox4.Controls.Add(this.m_outTotalTraffic);
|
||||||
|
this.groupBox4.Controls.Add(this.m_inTotalTraffic);
|
||||||
|
this.groupBox4.Controls.Add(this.label11);
|
||||||
|
this.groupBox4.Controls.Add(this.label12);
|
||||||
|
this.groupBox4.Location = new System.Drawing.Point(319, 20);
|
||||||
|
this.groupBox4.Name = "groupBox4";
|
||||||
|
this.groupBox4.Size = new System.Drawing.Size(148, 55);
|
||||||
|
this.groupBox4.TabIndex = 0;
|
||||||
|
this.groupBox4.TabStop = false;
|
||||||
|
this.groupBox4.Text = "Total";
|
||||||
|
//
|
||||||
|
// m_outTotalTraffic
|
||||||
|
//
|
||||||
|
this.m_outTotalTraffic.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
|
||||||
|
this.m_outTotalTraffic.Location = new System.Drawing.Point(43, 29);
|
||||||
|
this.m_outTotalTraffic.Name = "m_outTotalTraffic";
|
||||||
|
this.m_outTotalTraffic.Size = new System.Drawing.Size(90, 13);
|
||||||
|
this.m_outTotalTraffic.TabIndex = 1;
|
||||||
|
this.m_outTotalTraffic.Text = "0,00 kB/s";
|
||||||
|
//
|
||||||
|
// m_inTotalTraffic
|
||||||
|
//
|
||||||
|
this.m_inTotalTraffic.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
|
||||||
|
this.m_inTotalTraffic.Location = new System.Drawing.Point(43, 16);
|
||||||
|
this.m_inTotalTraffic.Name = "m_inTotalTraffic";
|
||||||
|
this.m_inTotalTraffic.Size = new System.Drawing.Size(90, 13);
|
||||||
|
this.m_inTotalTraffic.TabIndex = 1;
|
||||||
|
this.m_inTotalTraffic.Text = "0,00 kB/s";
|
||||||
|
//
|
||||||
|
// label11
|
||||||
|
//
|
||||||
|
this.label11.AutoSize = true;
|
||||||
|
this.label11.Location = new System.Drawing.Point(10, 29);
|
||||||
|
this.label11.Name = "label11";
|
||||||
|
this.label11.Size = new System.Drawing.Size(27, 13);
|
||||||
|
this.label11.TabIndex = 0;
|
||||||
|
this.label11.Text = "Out:";
|
||||||
|
//
|
||||||
|
// label12
|
||||||
|
//
|
||||||
|
this.label12.AutoSize = true;
|
||||||
|
this.label12.Location = new System.Drawing.Point(10, 16);
|
||||||
|
this.label12.Name = "label12";
|
||||||
|
this.label12.Size = new System.Drawing.Size(19, 13);
|
||||||
|
this.label12.TabIndex = 0;
|
||||||
|
this.label12.Text = "In:";
|
||||||
|
//
|
||||||
|
// groupBox3
|
||||||
|
//
|
||||||
|
this.groupBox3.Controls.Add(this.m_outTcpTraffic);
|
||||||
|
this.groupBox3.Controls.Add(this.m_inTcpTraffic);
|
||||||
|
this.groupBox3.Controls.Add(this.label7);
|
||||||
|
this.groupBox3.Controls.Add(this.label8);
|
||||||
|
this.groupBox3.Location = new System.Drawing.Point(165, 20);
|
||||||
|
this.groupBox3.Name = "groupBox3";
|
||||||
|
this.groupBox3.Size = new System.Drawing.Size(148, 55);
|
||||||
|
this.groupBox3.TabIndex = 0;
|
||||||
|
this.groupBox3.TabStop = false;
|
||||||
|
this.groupBox3.Text = "Tcp";
|
||||||
|
//
|
||||||
|
// m_outTcpTraffic
|
||||||
|
//
|
||||||
|
this.m_outTcpTraffic.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
|
||||||
|
this.m_outTcpTraffic.Location = new System.Drawing.Point(43, 29);
|
||||||
|
this.m_outTcpTraffic.Name = "m_outTcpTraffic";
|
||||||
|
this.m_outTcpTraffic.Size = new System.Drawing.Size(90, 13);
|
||||||
|
this.m_outTcpTraffic.TabIndex = 1;
|
||||||
|
this.m_outTcpTraffic.Text = "0,00 kB/s";
|
||||||
|
//
|
||||||
|
// m_inTcpTraffic
|
||||||
|
//
|
||||||
|
this.m_inTcpTraffic.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
|
||||||
|
this.m_inTcpTraffic.Location = new System.Drawing.Point(43, 16);
|
||||||
|
this.m_inTcpTraffic.Name = "m_inTcpTraffic";
|
||||||
|
this.m_inTcpTraffic.Size = new System.Drawing.Size(90, 13);
|
||||||
|
this.m_inTcpTraffic.TabIndex = 1;
|
||||||
|
this.m_inTcpTraffic.Text = "0,00 kB/s";
|
||||||
|
//
|
||||||
|
// label7
|
||||||
|
//
|
||||||
|
this.label7.AutoSize = true;
|
||||||
|
this.label7.Location = new System.Drawing.Point(10, 29);
|
||||||
|
this.label7.Name = "label7";
|
||||||
|
this.label7.Size = new System.Drawing.Size(27, 13);
|
||||||
|
this.label7.TabIndex = 0;
|
||||||
|
this.label7.Text = "Out:";
|
||||||
|
//
|
||||||
|
// label8
|
||||||
|
//
|
||||||
|
this.label8.AutoSize = true;
|
||||||
|
this.label8.Location = new System.Drawing.Point(10, 16);
|
||||||
|
this.label8.Name = "label8";
|
||||||
|
this.label8.Size = new System.Drawing.Size(19, 13);
|
||||||
|
this.label8.TabIndex = 0;
|
||||||
|
this.label8.Text = "In:";
|
||||||
|
//
|
||||||
|
// groupBox2
|
||||||
|
//
|
||||||
|
this.groupBox2.Controls.Add(this.m_outUdpTraffic);
|
||||||
|
this.groupBox2.Controls.Add(this.m_inUdpTraffic);
|
||||||
|
this.groupBox2.Controls.Add(this.label2);
|
||||||
|
this.groupBox2.Controls.Add(this.label1);
|
||||||
|
this.groupBox2.Location = new System.Drawing.Point(11, 20);
|
||||||
|
this.groupBox2.Name = "groupBox2";
|
||||||
|
this.groupBox2.Size = new System.Drawing.Size(148, 55);
|
||||||
|
this.groupBox2.TabIndex = 0;
|
||||||
|
this.groupBox2.TabStop = false;
|
||||||
|
this.groupBox2.Text = "Udp";
|
||||||
|
//
|
||||||
|
// m_outUdpTraffic
|
||||||
|
//
|
||||||
|
this.m_outUdpTraffic.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
|
||||||
|
this.m_outUdpTraffic.Location = new System.Drawing.Point(43, 29);
|
||||||
|
this.m_outUdpTraffic.Name = "m_outUdpTraffic";
|
||||||
|
this.m_outUdpTraffic.Size = new System.Drawing.Size(90, 13);
|
||||||
|
this.m_outUdpTraffic.TabIndex = 1;
|
||||||
|
this.m_outUdpTraffic.Text = "0,00 kB/s";
|
||||||
|
//
|
||||||
|
// m_inUdpTraffic
|
||||||
|
//
|
||||||
|
this.m_inUdpTraffic.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
|
||||||
|
this.m_inUdpTraffic.Location = new System.Drawing.Point(43, 16);
|
||||||
|
this.m_inUdpTraffic.Name = "m_inUdpTraffic";
|
||||||
|
this.m_inUdpTraffic.Size = new System.Drawing.Size(90, 13);
|
||||||
|
this.m_inUdpTraffic.TabIndex = 1;
|
||||||
|
this.m_inUdpTraffic.Text = "0,00 kB/s";
|
||||||
|
//
|
||||||
|
// label2
|
||||||
|
//
|
||||||
|
this.label2.AutoSize = true;
|
||||||
|
this.label2.Location = new System.Drawing.Point(10, 29);
|
||||||
|
this.label2.Name = "label2";
|
||||||
|
this.label2.Size = new System.Drawing.Size(27, 13);
|
||||||
|
this.label2.TabIndex = 0;
|
||||||
|
this.label2.Text = "Out:";
|
||||||
|
//
|
||||||
|
// label1
|
||||||
|
//
|
||||||
|
this.label1.AutoSize = true;
|
||||||
|
this.label1.Location = new System.Drawing.Point(10, 16);
|
||||||
|
this.label1.Name = "label1";
|
||||||
|
this.label1.Size = new System.Drawing.Size(19, 13);
|
||||||
|
this.label1.TabIndex = 0;
|
||||||
|
this.label1.Text = "In:";
|
||||||
|
//
|
||||||
|
// m_networkDrawing
|
||||||
|
//
|
||||||
|
this.m_networkDrawing.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
|
this.m_networkDrawing.Location = new System.Drawing.Point(3, 3);
|
||||||
|
this.m_networkDrawing.Name = "m_networkDrawing";
|
||||||
|
this.m_networkDrawing.Size = new System.Drawing.Size(584, 418);
|
||||||
|
this.m_networkDrawing.TabIndex = 1;
|
||||||
|
this.m_networkDrawing.TabStop = false;
|
||||||
|
//
|
||||||
|
// tabMemory
|
||||||
|
//
|
||||||
|
this.tabMemory.Controls.Add(this.tableLayoutPanel2);
|
||||||
|
this.tabMemory.Location = new System.Drawing.Point(4, 22);
|
||||||
|
this.tabMemory.Name = "tabMemory";
|
||||||
|
this.tabMemory.Padding = new System.Windows.Forms.Padding(3);
|
||||||
|
this.tabMemory.Size = new System.Drawing.Size(596, 524);
|
||||||
|
this.tabMemory.TabIndex = 2;
|
||||||
|
this.tabMemory.Text = "Memory";
|
||||||
|
this.tabMemory.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// tableLayoutPanel2
|
||||||
|
//
|
||||||
|
this.tableLayoutPanel2.ColumnCount = 1;
|
||||||
|
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
|
||||||
|
this.tableLayoutPanel2.Controls.Add(this.m_memStats, 0, 0);
|
||||||
|
this.tableLayoutPanel2.Controls.Add(this.groupBox5, 0, 1);
|
||||||
|
this.tableLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
|
this.tableLayoutPanel2.Location = new System.Drawing.Point(3, 3);
|
||||||
|
this.tableLayoutPanel2.Name = "tableLayoutPanel2";
|
||||||
|
this.tableLayoutPanel2.RowCount = 2;
|
||||||
|
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
|
||||||
|
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 72F));
|
||||||
|
this.tableLayoutPanel2.Size = new System.Drawing.Size(590, 518);
|
||||||
|
this.tableLayoutPanel2.TabIndex = 0;
|
||||||
|
//
|
||||||
|
// m_memStats
|
||||||
|
//
|
||||||
|
this.m_memStats.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
|
this.m_memStats.Location = new System.Drawing.Point(3, 3);
|
||||||
|
this.m_memStats.Name = "m_memStats";
|
||||||
|
this.m_memStats.Size = new System.Drawing.Size(584, 440);
|
||||||
|
this.m_memStats.TabIndex = 2;
|
||||||
|
this.m_memStats.TabStop = false;
|
||||||
|
//
|
||||||
|
// groupBox5
|
||||||
|
//
|
||||||
|
this.groupBox5.Controls.Add(this.m_availableMem);
|
||||||
|
this.groupBox5.Controls.Add(this.m_commitSize);
|
||||||
|
this.groupBox5.Controls.Add(this.label4);
|
||||||
|
this.groupBox5.Controls.Add(this.label3);
|
||||||
|
this.groupBox5.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
|
this.groupBox5.Location = new System.Drawing.Point(3, 449);
|
||||||
|
this.groupBox5.Name = "groupBox5";
|
||||||
|
this.groupBox5.Size = new System.Drawing.Size(584, 66);
|
||||||
|
this.groupBox5.TabIndex = 3;
|
||||||
|
this.groupBox5.TabStop = false;
|
||||||
|
this.groupBox5.Text = "Current memory usage";
|
||||||
|
//
|
||||||
|
// m_availableMem
|
||||||
|
//
|
||||||
|
this.m_availableMem.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
|
||||||
|
this.m_availableMem.Location = new System.Drawing.Point(90, 38);
|
||||||
|
this.m_availableMem.Name = "m_availableMem";
|
||||||
|
this.m_availableMem.Size = new System.Drawing.Size(100, 15);
|
||||||
|
this.m_availableMem.TabIndex = 1;
|
||||||
|
this.m_availableMem.Text = "0,00 mb";
|
||||||
|
//
|
||||||
|
// m_commitSize
|
||||||
|
//
|
||||||
|
this.m_commitSize.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
|
||||||
|
this.m_commitSize.Location = new System.Drawing.Point(90, 20);
|
||||||
|
this.m_commitSize.Name = "m_commitSize";
|
||||||
|
this.m_commitSize.Size = new System.Drawing.Size(100, 15);
|
||||||
|
this.m_commitSize.TabIndex = 1;
|
||||||
|
this.m_commitSize.Text = "0,00 mb";
|
||||||
|
//
|
||||||
|
// label4
|
||||||
|
//
|
||||||
|
this.label4.AutoSize = true;
|
||||||
|
this.label4.Location = new System.Drawing.Point(31, 39);
|
||||||
|
this.label4.Name = "label4";
|
||||||
|
this.label4.Size = new System.Drawing.Size(53, 13);
|
||||||
|
this.label4.TabIndex = 0;
|
||||||
|
this.label4.Text = "Available:";
|
||||||
|
//
|
||||||
|
// label3
|
||||||
|
//
|
||||||
|
this.label3.AutoSize = true;
|
||||||
|
this.label3.Location = new System.Drawing.Point(19, 21);
|
||||||
|
this.label3.Name = "label3";
|
||||||
|
this.label3.Size = new System.Drawing.Size(65, 13);
|
||||||
|
this.label3.TabIndex = 0;
|
||||||
|
this.label3.Text = "Commit size:";
|
||||||
|
//
|
||||||
|
// tabCpu
|
||||||
|
//
|
||||||
|
this.tabCpu.Controls.Add(this.tableLayoutPanel3);
|
||||||
|
this.tabCpu.Location = new System.Drawing.Point(4, 22);
|
||||||
|
this.tabCpu.Name = "tabCpu";
|
||||||
|
this.tabCpu.Padding = new System.Windows.Forms.Padding(3);
|
||||||
|
this.tabCpu.Size = new System.Drawing.Size(596, 524);
|
||||||
|
this.tabCpu.TabIndex = 3;
|
||||||
|
this.tabCpu.Text = "Cpu";
|
||||||
|
this.tabCpu.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// tableLayoutPanel3
|
||||||
|
//
|
||||||
|
this.tableLayoutPanel3.ColumnCount = 1;
|
||||||
|
this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
|
||||||
|
this.tableLayoutPanel3.Controls.Add(this.m_cpuDrawing, 0, 0);
|
||||||
|
this.tableLayoutPanel3.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
|
this.tableLayoutPanel3.Location = new System.Drawing.Point(3, 3);
|
||||||
|
this.tableLayoutPanel3.Name = "tableLayoutPanel3";
|
||||||
|
this.tableLayoutPanel3.RowCount = 2;
|
||||||
|
this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
|
||||||
|
this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
|
||||||
|
this.tableLayoutPanel3.Size = new System.Drawing.Size(590, 518);
|
||||||
|
this.tableLayoutPanel3.TabIndex = 0;
|
||||||
|
//
|
||||||
|
// m_cpuDrawing
|
||||||
|
//
|
||||||
|
this.m_cpuDrawing.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
|
this.m_cpuDrawing.Location = new System.Drawing.Point(3, 3);
|
||||||
|
this.m_cpuDrawing.Name = "m_cpuDrawing";
|
||||||
|
this.m_cpuDrawing.Size = new System.Drawing.Size(584, 492);
|
||||||
|
this.m_cpuDrawing.TabIndex = 0;
|
||||||
|
this.m_cpuDrawing.TabStop = false;
|
||||||
|
//
|
||||||
|
// tabPackets
|
||||||
|
//
|
||||||
|
this.tabPackets.Location = new System.Drawing.Point(4, 22);
|
||||||
|
this.tabPackets.Name = "tabPackets";
|
||||||
|
this.tabPackets.Padding = new System.Windows.Forms.Padding(3);
|
||||||
|
this.tabPackets.Size = new System.Drawing.Size(596, 524);
|
||||||
|
this.tabPackets.TabIndex = 4;
|
||||||
|
this.tabPackets.Text = "Packets";
|
||||||
|
this.tabPackets.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// StatusWindow
|
||||||
|
//
|
||||||
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
//AutoSizeMode didn't work with mono
|
||||||
|
//this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
|
||||||
|
this.ClientSize = new System.Drawing.Size(604, 550);
|
||||||
|
this.Controls.Add(this.panel1);
|
||||||
|
this.Name = "StatusWindow";
|
||||||
|
this.Text = "realXtend server status";
|
||||||
|
this.panel1.ResumeLayout(false);
|
||||||
|
this.tabControl1.ResumeLayout(false);
|
||||||
|
this.tabNetwork.ResumeLayout(false);
|
||||||
|
this.tableLayoutPanel1.ResumeLayout(false);
|
||||||
|
this.groupBox1.ResumeLayout(false);
|
||||||
|
this.groupBox4.ResumeLayout(false);
|
||||||
|
this.groupBox4.PerformLayout();
|
||||||
|
this.groupBox3.ResumeLayout(false);
|
||||||
|
this.groupBox3.PerformLayout();
|
||||||
|
this.groupBox2.ResumeLayout(false);
|
||||||
|
this.groupBox2.PerformLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.m_networkDrawing)).EndInit();
|
||||||
|
this.tabMemory.ResumeLayout(false);
|
||||||
|
this.tableLayoutPanel2.ResumeLayout(false);
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.m_memStats)).EndInit();
|
||||||
|
this.groupBox5.ResumeLayout(false);
|
||||||
|
this.groupBox5.PerformLayout();
|
||||||
|
this.tabCpu.ResumeLayout(false);
|
||||||
|
this.tableLayoutPanel3.ResumeLayout(false);
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.m_cpuDrawing)).EndInit();
|
||||||
|
this.ResumeLayout(false);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private System.Windows.Forms.Panel panel1;
|
||||||
|
private System.Windows.Forms.TabControl tabControl1;
|
||||||
|
private System.Windows.Forms.TabPage tabThreads;
|
||||||
|
private System.Windows.Forms.TabPage tabNetwork;
|
||||||
|
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
|
||||||
|
private System.Windows.Forms.GroupBox groupBox1;
|
||||||
|
private System.Windows.Forms.GroupBox groupBox4;
|
||||||
|
private System.Windows.Forms.Label m_outTotalTraffic;
|
||||||
|
private System.Windows.Forms.Label m_inTotalTraffic;
|
||||||
|
private System.Windows.Forms.Label label11;
|
||||||
|
private System.Windows.Forms.Label label12;
|
||||||
|
private System.Windows.Forms.GroupBox groupBox3;
|
||||||
|
private System.Windows.Forms.Label m_outTcpTraffic;
|
||||||
|
private System.Windows.Forms.Label m_inTcpTraffic;
|
||||||
|
private System.Windows.Forms.Label label7;
|
||||||
|
private System.Windows.Forms.Label label8;
|
||||||
|
private System.Windows.Forms.GroupBox groupBox2;
|
||||||
|
private System.Windows.Forms.Label m_outUdpTraffic;
|
||||||
|
private System.Windows.Forms.Label m_inUdpTraffic;
|
||||||
|
private System.Windows.Forms.Label label2;
|
||||||
|
private System.Windows.Forms.Label label1;
|
||||||
|
private System.Windows.Forms.PictureBox m_networkDrawing;
|
||||||
|
private System.Windows.Forms.TabPage tabMemory;
|
||||||
|
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel2;
|
||||||
|
private System.Windows.Forms.PictureBox m_memStats;
|
||||||
|
private System.Windows.Forms.GroupBox groupBox5;
|
||||||
|
private System.Windows.Forms.Label label4;
|
||||||
|
private System.Windows.Forms.Label label3;
|
||||||
|
private System.Windows.Forms.Label m_availableMem;
|
||||||
|
private System.Windows.Forms.Label m_commitSize;
|
||||||
|
private System.Windows.Forms.TabPage tabCpu;
|
||||||
|
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel3;
|
||||||
|
private System.Windows.Forms.PictureBox m_cpuDrawing;
|
||||||
|
private System.Windows.Forms.TabPage tabPackets;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,884 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Data;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Text;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using System.Timers;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
namespace OpenSim.Framework.ServerStatus
|
||||||
|
{
|
||||||
|
public partial class StatusWindow : Form
|
||||||
|
{
|
||||||
|
System.Timers.Timer m_updateTimer;
|
||||||
|
static Dictionary<int, ThreadItem> m_threadItems = new Dictionary<int, ThreadItem>();
|
||||||
|
static Dictionary<int, string> m_idToName = new Dictionary<int, string>();
|
||||||
|
static int m_nCoreCount = System.Environment.ProcessorCount;
|
||||||
|
|
||||||
|
PerformanceCounter m_pcAvailRam = null;
|
||||||
|
|
||||||
|
class TrafficHistory {
|
||||||
|
public float outUdpBytes = 0;
|
||||||
|
public float inUdpBytes = 0;
|
||||||
|
public float outTcpBytes = 0;
|
||||||
|
public float inTcpBytes = 0;
|
||||||
|
public float outTotalBytes = 0;
|
||||||
|
public float inTotalBytes = 0;
|
||||||
|
public float resentBytes = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
class MemoryHistory {
|
||||||
|
public float nonpagedSystemMemory;
|
||||||
|
public float pagedMemory;
|
||||||
|
public float pagedSystemMemory;
|
||||||
|
public float gcReportedMem;
|
||||||
|
public float workingSet;
|
||||||
|
}
|
||||||
|
|
||||||
|
class CpuHistory {
|
||||||
|
public float[] cpuUsage = new float[m_nCoreCount];
|
||||||
|
public float totalUsage = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
class PacketItem
|
||||||
|
{
|
||||||
|
public long m_bytesOut = 0;
|
||||||
|
public long m_packetsOut = 0;
|
||||||
|
public long m_bytesIn = 0;
|
||||||
|
public long m_packetsIn = 0;
|
||||||
|
public long m_resent = 0;
|
||||||
|
|
||||||
|
public bool m_addedToList = false;
|
||||||
|
public ListViewItem.ListViewSubItem m_listBytesOut = null;
|
||||||
|
public ListViewItem.ListViewSubItem m_listPacketsOut = null;
|
||||||
|
public ListViewItem.ListViewSubItem m_listBytesIn = null;
|
||||||
|
public ListViewItem.ListViewSubItem m_listPacketsIn = null;
|
||||||
|
public ListViewItem.ListViewSubItem m_listResent = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
static float m_fNetworkHistoryScale;
|
||||||
|
static float m_fMemoryHistoryScale;
|
||||||
|
|
||||||
|
static Dictionary<string, PacketItem> m_packets = new Dictionary<string, PacketItem>();
|
||||||
|
static LinkedList<TrafficHistory> m_trafficHistory = new LinkedList<TrafficHistory>();
|
||||||
|
static LinkedList<MemoryHistory> m_memoryHistory = new LinkedList<MemoryHistory>();
|
||||||
|
static LinkedList<CpuHistory> m_cpuHistory = new LinkedList<CpuHistory>();
|
||||||
|
|
||||||
|
PerformanceCounter[] m_pcCpu = new PerformanceCounter[System.Environment.ProcessorCount];
|
||||||
|
PerformanceCounter m_pcCpuTotal = null;
|
||||||
|
|
||||||
|
static volatile int outUdpBytes = 0;
|
||||||
|
static volatile int inUdpBytes = 0;
|
||||||
|
static volatile int outTcpBytes = 0;
|
||||||
|
static volatile int inTcpBytes = 0;
|
||||||
|
static volatile int outResent = 0;
|
||||||
|
|
||||||
|
BufferedListView m_threads;
|
||||||
|
BufferedListView m_listPackets;
|
||||||
|
|
||||||
|
#region BufferedListView
|
||||||
|
/**
|
||||||
|
* Flicker minimized listview
|
||||||
|
**/
|
||||||
|
public class BufferedListView : ListView
|
||||||
|
{
|
||||||
|
#region WM - Window Messages
|
||||||
|
public enum WM
|
||||||
|
{
|
||||||
|
WM_NULL = 0x0000,
|
||||||
|
WM_CREATE = 0x0001,
|
||||||
|
WM_DESTROY = 0x0002,
|
||||||
|
WM_MOVE = 0x0003,
|
||||||
|
WM_SIZE = 0x0005,
|
||||||
|
WM_ACTIVATE = 0x0006,
|
||||||
|
WM_SETFOCUS = 0x0007,
|
||||||
|
WM_KILLFOCUS = 0x0008,
|
||||||
|
WM_ENABLE = 0x000A,
|
||||||
|
WM_SETREDRAW = 0x000B,
|
||||||
|
WM_SETTEXT = 0x000C,
|
||||||
|
WM_GETTEXT = 0x000D,
|
||||||
|
WM_GETTEXTLENGTH = 0x000E,
|
||||||
|
WM_PAINT = 0x000F,
|
||||||
|
WM_CLOSE = 0x0010,
|
||||||
|
WM_QUERYENDSESSION = 0x0011,
|
||||||
|
WM_QUIT = 0x0012,
|
||||||
|
WM_QUERYOPEN = 0x0013,
|
||||||
|
WM_ERASEBKGND = 0x0014,
|
||||||
|
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region RECT
|
||||||
|
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
|
||||||
|
public struct RECT
|
||||||
|
{
|
||||||
|
public int left;
|
||||||
|
public int top;
|
||||||
|
public int right;
|
||||||
|
public int bottom;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Imported User32.DLL functions
|
||||||
|
[DllImport("user32.dll", CharSet = CharSet.Auto)]
|
||||||
|
static public extern bool ValidateRect(IntPtr handle, ref RECT rect);
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region GetWindowRECT
|
||||||
|
// Get the listview's rectangle and return it as a RECT structure
|
||||||
|
private RECT GetWindowRECT()
|
||||||
|
{
|
||||||
|
RECT rect = new RECT();
|
||||||
|
rect.left = this.Left;
|
||||||
|
rect.right = this.Right;
|
||||||
|
rect.top = this.Top;
|
||||||
|
rect.bottom = this.Bottom;
|
||||||
|
return rect;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
volatile public bool updating = false;
|
||||||
|
|
||||||
|
public BufferedListView()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected override void OnPaintBackground(PaintEventArgs pea)
|
||||||
|
{
|
||||||
|
// do nothing here since this event is now handled by OnPaint
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected override void OnPaint(PaintEventArgs pea)
|
||||||
|
{
|
||||||
|
base.OnPaint(pea);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void WndProc(ref Message messg)
|
||||||
|
{
|
||||||
|
if (updating)
|
||||||
|
{
|
||||||
|
if ((int)WM.WM_ERASEBKGND == messg.Msg)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if ((int)WM.WM_PAINT == messg.Msg)
|
||||||
|
{
|
||||||
|
RECT vrect = this.GetWindowRECT();
|
||||||
|
// validate the entire window
|
||||||
|
ValidateRect(this.Handle, ref vrect);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
base.WndProc(ref messg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region ThreadItem
|
||||||
|
/**
|
||||||
|
* Represents a single thread item in the listview control
|
||||||
|
**/
|
||||||
|
class ThreadItem
|
||||||
|
{
|
||||||
|
public ListViewItem listItem;
|
||||||
|
public ListViewItem.ListViewSubItem name;
|
||||||
|
public ListViewItem.ListViewSubItem cpu;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
public static void ReportOutPacketUdp(int size, bool resent)
|
||||||
|
{
|
||||||
|
if (resent)
|
||||||
|
{
|
||||||
|
outResent += size += 8;
|
||||||
|
}
|
||||||
|
outUdpBytes += size + 8;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void ReportInPacketUdp(int size) { inUdpBytes += size + 8; }
|
||||||
|
|
||||||
|
public static void ReportOutPacketTcp(int size) { outTcpBytes += size + 20; }
|
||||||
|
public static void ReportInPacketTcp(int size) { inTcpBytes += size + 20; }
|
||||||
|
|
||||||
|
public static void ReportProcessedOutPacket(string name, int size, bool resent)
|
||||||
|
{
|
||||||
|
PacketItem item = null;
|
||||||
|
if (m_packets.ContainsKey(name))
|
||||||
|
{
|
||||||
|
item = m_packets[name];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
item = new PacketItem();
|
||||||
|
m_packets[name] = item;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (resent)
|
||||||
|
{
|
||||||
|
item.m_resent += size;
|
||||||
|
}
|
||||||
|
item.m_bytesOut += size;
|
||||||
|
item.m_packetsOut++;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void ReportProcessedInPacket(string name, int size)
|
||||||
|
{
|
||||||
|
PacketItem item = null;
|
||||||
|
if (m_packets.ContainsKey(name))
|
||||||
|
{
|
||||||
|
item = m_packets[name];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
item = new PacketItem();
|
||||||
|
m_packets[name] = item;
|
||||||
|
}
|
||||||
|
|
||||||
|
item.m_bytesIn += size;
|
||||||
|
item.m_packetsIn++;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public StatusWindow()
|
||||||
|
{
|
||||||
|
m_pcAvailRam = new PerformanceCounter("Memory", "Available MBytes");
|
||||||
|
m_packets = new Dictionary<string, PacketItem>();
|
||||||
|
|
||||||
|
InitializeComponent();
|
||||||
|
|
||||||
|
m_listPackets = new BufferedListView();
|
||||||
|
m_listPackets.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
|
m_listPackets.GridLines = true;
|
||||||
|
m_listPackets.Location = new System.Drawing.Point(3, 3);
|
||||||
|
m_listPackets.MultiSelect = false;
|
||||||
|
m_listPackets.Name = "m_listPackets";
|
||||||
|
m_listPackets.Size = new System.Drawing.Size(500, 400);
|
||||||
|
m_listPackets.TabIndex = 0;
|
||||||
|
m_listPackets.View = System.Windows.Forms.View.Details;
|
||||||
|
|
||||||
|
tabPackets.Controls.Add(m_listPackets);
|
||||||
|
|
||||||
|
m_listPackets.Columns.Add("Packet").Width = 260;
|
||||||
|
m_listPackets.Columns.Add("In count").Width = 80;
|
||||||
|
m_listPackets.Columns.Add("In bytes").Width = 80;
|
||||||
|
m_listPackets.Columns.Add("Out count").Width = 80;
|
||||||
|
m_listPackets.Columns.Add("Out bytes").Width = 80;
|
||||||
|
m_listPackets.Columns.Add("Resent").Width = 80;
|
||||||
|
|
||||||
|
|
||||||
|
m_threads = new BufferedListView();
|
||||||
|
m_threads.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
|
m_threads.GridLines = true;
|
||||||
|
m_threads.Location = new System.Drawing.Point(3, 3);
|
||||||
|
m_threads.MultiSelect = false;
|
||||||
|
m_threads.Name = "m_threads";
|
||||||
|
m_threads.Size = new System.Drawing.Size(500, 400);
|
||||||
|
m_threads.TabIndex = 0;
|
||||||
|
m_threads.View = System.Windows.Forms.View.Details;
|
||||||
|
|
||||||
|
tabThreads.Controls.Add(m_threads);
|
||||||
|
|
||||||
|
m_threads.Columns.Add("ID");
|
||||||
|
m_threads.Columns.Add("Name").Width = 260;
|
||||||
|
m_threads.Columns.Add("CPU Time").Width=100;
|
||||||
|
|
||||||
|
m_updateTimer = new System.Timers.Timer(2000);
|
||||||
|
m_updateTimer.Elapsed += new ElapsedEventHandler(UpdateTimer);
|
||||||
|
outUdpBytes = 0;
|
||||||
|
inUdpBytes = 0;
|
||||||
|
outTcpBytes = 0;
|
||||||
|
inTcpBytes = 0;
|
||||||
|
outResent = 0;
|
||||||
|
m_updateTimer.Start();
|
||||||
|
|
||||||
|
for(int i = 0; i < m_nCoreCount; i++)
|
||||||
|
{
|
||||||
|
m_pcCpu[i] = new PerformanceCounter("Processor", "% Processor Time", i.ToString(), true);
|
||||||
|
m_pcCpu[i].MachineName = ".";
|
||||||
|
}
|
||||||
|
m_pcCpuTotal = new PerformanceCounter("Processor", "% Processor Time", "_Total", true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void CloseStatusWindow() {
|
||||||
|
Close();
|
||||||
|
m_updateTimer.Stop();
|
||||||
|
m_threadItems.Clear();
|
||||||
|
|
||||||
|
m_pcAvailRam.Close();
|
||||||
|
m_pcAvailRam = null;
|
||||||
|
|
||||||
|
for (int i = 0; i < m_nCoreCount; i++)
|
||||||
|
{
|
||||||
|
m_pcCpu[i].Close();
|
||||||
|
m_pcCpu[i] = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach(PacketItem item in m_packets.Values)
|
||||||
|
{
|
||||||
|
item.m_addedToList = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_packets = null;
|
||||||
|
|
||||||
|
m_pcCpuTotal.Close();
|
||||||
|
m_pcCpuTotal = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void ReportThreadName(int id, string name)
|
||||||
|
{
|
||||||
|
lock (m_threadItems)
|
||||||
|
{
|
||||||
|
m_idToName[id] = name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
delegate void UpdateControlsDelegate();
|
||||||
|
|
||||||
|
TrafficHistory UpdateNetworkHistory()
|
||||||
|
{
|
||||||
|
TrafficHistory item = new TrafficHistory();
|
||||||
|
|
||||||
|
item.inUdpBytes = ((float)inUdpBytes) / 1024.0f / 2.0f;
|
||||||
|
item.outUdpBytes = ((float)outUdpBytes) / 1024.0f / 2.0f;
|
||||||
|
item.inTcpBytes = ((float)inTcpBytes) / 1024.0f / 2.0f;
|
||||||
|
item.outTcpBytes = ((float)outTcpBytes) / 1024.0f / 2.0f;
|
||||||
|
item.resentBytes = ((float)outResent) / 1024.0f / 2.0f;
|
||||||
|
item.inTotalBytes = item.inUdpBytes + item.inTcpBytes;
|
||||||
|
item.outTotalBytes = item.outUdpBytes + item.outTcpBytes;
|
||||||
|
inUdpBytes = 0;
|
||||||
|
outUdpBytes = 0;
|
||||||
|
inTcpBytes = 0;
|
||||||
|
outTcpBytes = 0;
|
||||||
|
outResent = 0;
|
||||||
|
|
||||||
|
m_trafficHistory.AddFirst(item);
|
||||||
|
if (m_trafficHistory.Count > 500)
|
||||||
|
{
|
||||||
|
m_trafficHistory.RemoveLast();
|
||||||
|
}
|
||||||
|
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
|
||||||
|
MemoryHistory UpdateMemoryHistory(Process proc)
|
||||||
|
{
|
||||||
|
MemoryHistory item = new MemoryHistory();
|
||||||
|
|
||||||
|
item.gcReportedMem = ((float)System.GC.GetTotalMemory(false)) / 1024.0f / 1024.0f;
|
||||||
|
item.workingSet = ((float)proc.WorkingSet64) / 1024.0f / 1024.0f;
|
||||||
|
item.nonpagedSystemMemory = ((float)proc.NonpagedSystemMemorySize64) / 1024.0f / 1024.0f;
|
||||||
|
item.pagedSystemMemory = ((float)proc.PagedMemorySize64) / 1024.0f / 1024.0f;
|
||||||
|
item.pagedSystemMemory = ((float)proc.PagedSystemMemorySize64) / 1024.0f / 1024.0f;
|
||||||
|
|
||||||
|
m_memoryHistory.AddFirst(item);
|
||||||
|
if (m_memoryHistory.Count > 500)
|
||||||
|
{
|
||||||
|
m_memoryHistory.RemoveLast();
|
||||||
|
}
|
||||||
|
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
|
||||||
|
void UpdateCpuHistory() {
|
||||||
|
CpuHistory item = new CpuHistory();
|
||||||
|
|
||||||
|
for( int i = 0; i < m_nCoreCount; i++)
|
||||||
|
{
|
||||||
|
item.cpuUsage[i] = m_pcCpu[i].NextValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
item.totalUsage = m_pcCpuTotal.NextValue();
|
||||||
|
|
||||||
|
m_cpuHistory.AddFirst(item);
|
||||||
|
if (m_cpuHistory.Count > 500)
|
||||||
|
{
|
||||||
|
m_cpuHistory.RemoveLast();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
string FormatDataSize(long byteCount)
|
||||||
|
{
|
||||||
|
double fCount = (double)byteCount;
|
||||||
|
if (byteCount > 1024 * 1024 * 1024)
|
||||||
|
{
|
||||||
|
fCount/=(1024.0*1024.0*1024.0);
|
||||||
|
return fCount.ToString("##0.00") + "GB";
|
||||||
|
}
|
||||||
|
else if (byteCount > 1024*1024*10)
|
||||||
|
{
|
||||||
|
fCount/=(1024.0*1024.0);
|
||||||
|
return fCount.ToString("##0.00") + "MB";
|
||||||
|
}
|
||||||
|
else if (byteCount > 1024*10)
|
||||||
|
{
|
||||||
|
fCount/=1024.0;
|
||||||
|
return fCount.ToString("##0.00") + "KB";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return byteCount.ToString() +"B";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void UpdatePacketView()
|
||||||
|
{
|
||||||
|
foreach(KeyValuePair<string, PacketItem> item in m_packets)
|
||||||
|
{
|
||||||
|
if (item.Value.m_addedToList)
|
||||||
|
{
|
||||||
|
item.Value.m_listPacketsIn.Text = item.Value.m_packetsIn.ToString();
|
||||||
|
item.Value.m_listBytesIn.Text = FormatDataSize(item.Value.m_bytesIn);
|
||||||
|
item.Value.m_listPacketsOut.Text = item.Value.m_packetsOut.ToString();
|
||||||
|
item.Value.m_listBytesOut.Text = FormatDataSize(item.Value.m_bytesOut);
|
||||||
|
item.Value.m_listResent.Text = FormatDataSize(item.Value.m_resent);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ListViewItem listItem = m_listPackets.Items.Add(item.Key);
|
||||||
|
item.Value.m_listPacketsIn = listItem.SubItems.Add(item.Value.m_packetsIn.ToString());
|
||||||
|
item.Value.m_listBytesIn = listItem.SubItems.Add(FormatDataSize(item.Value.m_bytesIn));
|
||||||
|
item.Value.m_listPacketsOut = listItem.SubItems.Add(item.Value.m_packetsOut.ToString());
|
||||||
|
item.Value.m_listBytesOut = listItem.SubItems.Add(FormatDataSize(item.Value.m_bytesOut));
|
||||||
|
item.Value.m_listResent = listItem.SubItems.Add(FormatDataSize(item.Value.m_resent));
|
||||||
|
item.Value.m_addedToList = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void UpdateControls()
|
||||||
|
{
|
||||||
|
Process proc = Process.GetCurrentProcess();
|
||||||
|
|
||||||
|
TrafficHistory netItem = UpdateNetworkHistory();
|
||||||
|
MemoryHistory memItem = UpdateMemoryHistory(proc);
|
||||||
|
|
||||||
|
UpdateCpuHistory();
|
||||||
|
|
||||||
|
if (tabControl1.SelectedIndex == 0)
|
||||||
|
{
|
||||||
|
m_threads.updating = true;
|
||||||
|
UpdateThreadList();
|
||||||
|
m_threads.updating = false;
|
||||||
|
m_threads.Invalidate();
|
||||||
|
}
|
||||||
|
else if (tabControl1.SelectedIndex == 1)
|
||||||
|
{
|
||||||
|
RefreshNetworkStats(netItem);
|
||||||
|
PaintNetworkHistory();
|
||||||
|
}
|
||||||
|
else if (tabControl1.SelectedIndex == 2)
|
||||||
|
{
|
||||||
|
m_availableMem.Text = m_pcAvailRam.NextValue().ToString("##0.00") + " MB";
|
||||||
|
m_commitSize.Text = memItem.workingSet.ToString("##0.00") + " MB";
|
||||||
|
PaintMemoryHistory();
|
||||||
|
}
|
||||||
|
else if (tabControl1.SelectedIndex == 3)
|
||||||
|
{
|
||||||
|
PaintCpuHistory();
|
||||||
|
}
|
||||||
|
else if (tabControl1.SelectedIndex == 4)
|
||||||
|
{
|
||||||
|
m_listPackets.updating = true;
|
||||||
|
UpdatePacketView();
|
||||||
|
m_listPackets.updating = false;
|
||||||
|
m_listPackets.Invalidate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void PaintCpuHistory()
|
||||||
|
{
|
||||||
|
Pen[] pens = { Pens.Yellow, Pens.Blue, Pens.Green, Pens.Red,
|
||||||
|
Pens.White, Pens.Turquoise, Pens.Linen, Pens.Gray,
|
||||||
|
Pens.Purple, Pens.Pink, Pens.LightBlue, Pens.LightSalmon};
|
||||||
|
|
||||||
|
Pen penLine = Pens.DarkSlateGray;
|
||||||
|
|
||||||
|
Graphics screenGfx = m_cpuDrawing.CreateGraphics();
|
||||||
|
Bitmap backBuffer = new Bitmap(m_cpuDrawing.Width, m_cpuDrawing.Height);
|
||||||
|
Graphics gfx = Graphics.FromImage(backBuffer);
|
||||||
|
|
||||||
|
gfx.Clear(Color.Black);
|
||||||
|
|
||||||
|
float fMax = 105.0f;
|
||||||
|
for (int i = 0; i < m_cpuDrawing.Height - 10; i += 30)
|
||||||
|
{
|
||||||
|
float yPos = m_cpuDrawing.Height - i - 15;
|
||||||
|
float fPos = ((float)(i)) / ((float)m_cpuDrawing.Height);
|
||||||
|
gfx.DrawLine(penLine, 0, yPos, m_cpuDrawing.Width, yPos);
|
||||||
|
}
|
||||||
|
|
||||||
|
//Size of second in pixels
|
||||||
|
float fSecondStep = 2.5f; //120 seconds
|
||||||
|
float fTotalSeconds = (1 / fSecondStep) * (m_cpuDrawing.Width - 90);
|
||||||
|
for (int i = 0; i < m_cpuDrawing.Width - 90; i += 50)
|
||||||
|
{
|
||||||
|
float xPos = 90 + i;
|
||||||
|
float fTime = fTotalSeconds - (((float)(i)) / fSecondStep);
|
||||||
|
|
||||||
|
gfx.DrawLine(penLine, xPos, 0, xPos, m_cpuDrawing.Height - 15);
|
||||||
|
string strText = fTime.ToString("##0");
|
||||||
|
gfx.DrawString(strText, SystemFonts.DialogFont, Brushes.CadetBlue,
|
||||||
|
xPos - 4 * strText.Length, m_cpuDrawing.Height - 15);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
float nXPos = m_cpuDrawing.Width;
|
||||||
|
float fHeightMul = m_cpuDrawing.Height - 15;
|
||||||
|
float fYStart = m_cpuDrawing.Height - 15;
|
||||||
|
CpuHistory lastItem = null;
|
||||||
|
|
||||||
|
foreach (CpuHistory item in m_cpuHistory)
|
||||||
|
{
|
||||||
|
if (lastItem != null)
|
||||||
|
{
|
||||||
|
nXPos -= fSecondStep * 2;
|
||||||
|
|
||||||
|
for (int i = 0; i < m_nCoreCount; i++)
|
||||||
|
{
|
||||||
|
gfx.DrawLine(pens[i+1], nXPos, fYStart - (item.cpuUsage[i] / fMax) * fHeightMul,
|
||||||
|
nXPos + fSecondStep * 2, fYStart - (lastItem.cpuUsage[i] / fMax) * fHeightMul);
|
||||||
|
}
|
||||||
|
|
||||||
|
gfx.DrawLine(pens[0], nXPos, fYStart - (item.totalUsage / fMax) * fHeightMul,
|
||||||
|
nXPos + fSecondStep * 2, fYStart - (lastItem.totalUsage / fMax) * fHeightMul);
|
||||||
|
|
||||||
|
if (nXPos < 0)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
lastItem = item;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < m_cpuDrawing.Height - 10; i += 30)
|
||||||
|
{
|
||||||
|
float yPos = m_cpuDrawing.Height - i - 15;
|
||||||
|
float fPos = ((float)(i)) / ((float)m_cpuDrawing.Height);
|
||||||
|
gfx.DrawString((fPos * fMax).ToString("##0.00") + "%",
|
||||||
|
SystemFonts.DialogFont, Brushes.CadetBlue, 3, yPos);
|
||||||
|
}
|
||||||
|
|
||||||
|
int nPosX = m_cpuDrawing.Width - 50;
|
||||||
|
|
||||||
|
|
||||||
|
gfx.DrawString("Total", SystemFonts.DialogFont, pens[0].Brush, nPosX, 10);
|
||||||
|
for (int i = 0; i < m_nCoreCount; i++ )
|
||||||
|
{
|
||||||
|
gfx.DrawString("Core " + i, SystemFonts.DialogFont, pens[i+1].Brush, nPosX, 22 + i * 12);
|
||||||
|
}
|
||||||
|
|
||||||
|
screenGfx.DrawImageUnscaled(backBuffer, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void PaintNetworkHistory()
|
||||||
|
{
|
||||||
|
Pen penUdpOut = Pens.SkyBlue;
|
||||||
|
Pen penUdpIn = Pens.Blue;
|
||||||
|
Pen penTcpOut = Pens.Red;
|
||||||
|
Pen penTcpIn = Pens.Pink;
|
||||||
|
Pen penTotalOut = Pens.Green;
|
||||||
|
Pen penTotalIn = Pens.LimeGreen;
|
||||||
|
Pen penResent = Pens.Orange;
|
||||||
|
|
||||||
|
Pen penLine = Pens.DarkSlateGray;
|
||||||
|
|
||||||
|
|
||||||
|
Graphics screenGfx = m_networkDrawing.CreateGraphics();
|
||||||
|
Bitmap backBuffer = new Bitmap(m_networkDrawing.Width, m_networkDrawing.Height);
|
||||||
|
Graphics gfx = Graphics.FromImage(backBuffer);
|
||||||
|
|
||||||
|
gfx.Clear(Color.Black);
|
||||||
|
|
||||||
|
float fMax = m_fNetworkHistoryScale;
|
||||||
|
if (fMax < 12.0f)
|
||||||
|
fMax = 12.0f;
|
||||||
|
for( int i = 0; i < m_networkDrawing.Height-10; i+= 30)
|
||||||
|
{
|
||||||
|
float yPos = m_networkDrawing.Height - i-15;
|
||||||
|
float fPos = ((float)(i)) / ((float)m_networkDrawing.Height);
|
||||||
|
gfx.DrawLine(penLine, 0, yPos, m_networkDrawing.Width, yPos);
|
||||||
|
}
|
||||||
|
|
||||||
|
//Size of second in pixels
|
||||||
|
float fSecondStep = 1.5f; //120 seconds
|
||||||
|
float fTotalSeconds = (1/fSecondStep) * (m_networkDrawing.Width - 90);
|
||||||
|
for( int i = 0; i < m_networkDrawing.Width-90; i+= 50)
|
||||||
|
{
|
||||||
|
float xPos = 90 + i;
|
||||||
|
float fTime = fTotalSeconds - (((float)(i)) / fSecondStep);
|
||||||
|
|
||||||
|
gfx.DrawLine(penLine, xPos, 0, xPos, m_networkDrawing.Height - 15);
|
||||||
|
string strText = fTime.ToString("##0");
|
||||||
|
gfx.DrawString(strText, SystemFonts.DialogFont, Brushes.CadetBlue,
|
||||||
|
xPos - 4 * strText.Length, m_networkDrawing.Height - 15);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
float nXPos = m_networkDrawing.Width;
|
||||||
|
float fHeightMul = m_networkDrawing.Height - 15;
|
||||||
|
float fYStart = m_networkDrawing.Height - 15;
|
||||||
|
TrafficHistory lastItem = null;
|
||||||
|
|
||||||
|
float fHighestRate = 0;
|
||||||
|
foreach(TrafficHistory item in m_trafficHistory) {
|
||||||
|
if (lastItem != null)
|
||||||
|
{
|
||||||
|
nXPos -= fSecondStep * 2;
|
||||||
|
|
||||||
|
gfx.DrawLine(penUdpIn, nXPos, fYStart - (item.inUdpBytes / fMax) * fHeightMul,
|
||||||
|
nXPos + fSecondStep * 2, fYStart - (lastItem.inUdpBytes / fMax) * fHeightMul);
|
||||||
|
gfx.DrawLine(penUdpOut, nXPos, fYStart - (item.outUdpBytes / fMax) * fHeightMul,
|
||||||
|
nXPos + fSecondStep * 2, fYStart - (lastItem.outUdpBytes / fMax) * fHeightMul);
|
||||||
|
|
||||||
|
gfx.DrawLine(penTcpIn, nXPos, fYStart - (item.inTcpBytes / fMax) * fHeightMul,
|
||||||
|
nXPos + fSecondStep * 2, fYStart - (lastItem.inTcpBytes / fMax) * fHeightMul);
|
||||||
|
gfx.DrawLine(penTcpOut, nXPos, fYStart - (item.outTcpBytes / fMax) * fHeightMul,
|
||||||
|
nXPos + fSecondStep * 2, fYStart - (lastItem.outTcpBytes / fMax) * fHeightMul);
|
||||||
|
|
||||||
|
gfx.DrawLine(penTotalIn, nXPos, fYStart - (item.inTotalBytes / fMax) * fHeightMul,
|
||||||
|
nXPos + fSecondStep * 2, fYStart - (lastItem.inTotalBytes / fMax) * fHeightMul);
|
||||||
|
gfx.DrawLine(penTotalOut, nXPos, fYStart - (item.outTotalBytes / fMax) * fHeightMul,
|
||||||
|
nXPos + fSecondStep * 2, fYStart - (lastItem.outTotalBytes / fMax) * fHeightMul);
|
||||||
|
|
||||||
|
gfx.DrawLine(penResent, nXPos, fYStart - (item.resentBytes / fMax) * fHeightMul,
|
||||||
|
nXPos + fSecondStep * 2, fYStart - (lastItem.resentBytes / fMax) * fHeightMul);
|
||||||
|
|
||||||
|
if (nXPos < 0)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
lastItem = item;
|
||||||
|
if (item.inTotalBytes > fHighestRate)
|
||||||
|
fHighestRate = item.inTotalBytes;
|
||||||
|
if (item.outTotalBytes > fHighestRate)
|
||||||
|
fHighestRate = item.outTotalBytes;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < m_networkDrawing.Height - 10; i += 30)
|
||||||
|
{
|
||||||
|
float yPos = m_networkDrawing.Height - i - 15;
|
||||||
|
float fPos = ((float)(i)) / ((float)m_networkDrawing.Height);
|
||||||
|
gfx.DrawString((fPos * fMax).ToString("##0.00") + " KB/s",
|
||||||
|
SystemFonts.DialogFont, Brushes.CadetBlue, 3, yPos);
|
||||||
|
}
|
||||||
|
|
||||||
|
int nPosX = m_networkDrawing.Width-60;
|
||||||
|
gfx.DrawString("Udp in", SystemFonts.DialogFont, penUdpIn.Brush, nPosX, 10);
|
||||||
|
gfx.DrawString("Udp out", SystemFonts.DialogFont, penUdpOut.Brush, nPosX, 22);
|
||||||
|
gfx.DrawString("Tcp in", SystemFonts.DialogFont, penTcpIn.Brush, nPosX, 34);
|
||||||
|
gfx.DrawString("Tcp out", SystemFonts.DialogFont, penTcpOut.Brush, nPosX, 46);
|
||||||
|
gfx.DrawString("Total in", SystemFonts.DialogFont, penTotalIn.Brush, nPosX, 58);
|
||||||
|
gfx.DrawString("Total out", SystemFonts.DialogFont, penTotalOut.Brush, nPosX, 70);
|
||||||
|
gfx.DrawString("Resent", SystemFonts.DialogFont, penResent.Brush, nPosX, 82);
|
||||||
|
|
||||||
|
screenGfx.DrawImageUnscaled(backBuffer, 0, 0);
|
||||||
|
|
||||||
|
m_fNetworkHistoryScale = fHighestRate + 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void PaintMemoryHistory()
|
||||||
|
{
|
||||||
|
Pen penPagedMemory = Pens.Gray;
|
||||||
|
Pen penPagedSystemMemory = Pens.Orange;
|
||||||
|
Pen penNonPagedMemory = Pens.LawnGreen;
|
||||||
|
Pen penWorkingSet = Pens.HotPink;
|
||||||
|
Pen penGcReported = Pens.Red;
|
||||||
|
|
||||||
|
|
||||||
|
Pen penLine = Pens.DarkSlateGray;
|
||||||
|
|
||||||
|
Graphics screenGfx = m_memStats.CreateGraphics();
|
||||||
|
Bitmap backBuffer = new Bitmap(m_memStats.Width, m_memStats.Height);
|
||||||
|
Graphics gfx = Graphics.FromImage(backBuffer);
|
||||||
|
|
||||||
|
gfx.Clear(Color.Black);
|
||||||
|
|
||||||
|
float fMax = m_fMemoryHistoryScale;
|
||||||
|
if (fMax < 12.0f)
|
||||||
|
fMax = 12.0f;
|
||||||
|
for (int i = 0; i < m_memStats.Height - 10; i += 30)
|
||||||
|
{
|
||||||
|
float yPos = m_memStats.Height - i - 15;
|
||||||
|
float fPos = ((float)(i)) / ((float)m_memStats.Height);
|
||||||
|
gfx.DrawLine(penLine, 0, yPos, m_memStats.Width, yPos);
|
||||||
|
}
|
||||||
|
|
||||||
|
//Size of second in pixels
|
||||||
|
float fSecondStep = 1.5f; //120 seconds
|
||||||
|
float fTotalSeconds = (1 / fSecondStep) * (m_memStats.Width - 90);
|
||||||
|
for (int i = 0; i < m_memStats.Width - 90; i += 50)
|
||||||
|
{
|
||||||
|
float xPos = 90 + i;
|
||||||
|
float fTime = fTotalSeconds - (((float)(i)) / fSecondStep);
|
||||||
|
|
||||||
|
gfx.DrawLine(penLine, xPos, 0, xPos, m_memStats.Height - 15);
|
||||||
|
string strText = fTime.ToString("##0");
|
||||||
|
gfx.DrawString(strText, SystemFonts.DialogFont, Brushes.CadetBlue,
|
||||||
|
xPos - 4 * strText.Length, m_memStats.Height - 15);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
float nXPos = m_memStats.Width;
|
||||||
|
float fHeightMul = m_memStats.Height - 15;
|
||||||
|
float fYStart = m_memStats.Height - 15;
|
||||||
|
MemoryHistory lastItem = null;
|
||||||
|
|
||||||
|
float fHighestRate = 0;
|
||||||
|
foreach (MemoryHistory item in m_memoryHistory)
|
||||||
|
{
|
||||||
|
if (lastItem != null)
|
||||||
|
{
|
||||||
|
|
||||||
|
nXPos -= fSecondStep * 2;
|
||||||
|
|
||||||
|
gfx.DrawLine(penPagedMemory, nXPos, fYStart - (item.pagedMemory / fMax) * fHeightMul,
|
||||||
|
nXPos + fSecondStep * 2, fYStart - (lastItem.pagedMemory / fMax) * fHeightMul);
|
||||||
|
|
||||||
|
gfx.DrawLine(penPagedSystemMemory, nXPos, fYStart - (item.pagedSystemMemory / fMax) * fHeightMul,
|
||||||
|
nXPos + fSecondStep * 2, fYStart - (lastItem.pagedSystemMemory / fMax) * fHeightMul);
|
||||||
|
|
||||||
|
gfx.DrawLine(penNonPagedMemory, nXPos, fYStart - (item.nonpagedSystemMemory / fMax) * fHeightMul,
|
||||||
|
nXPos + fSecondStep * 2, fYStart - (lastItem.nonpagedSystemMemory / fMax) * fHeightMul);
|
||||||
|
|
||||||
|
gfx.DrawLine(penWorkingSet, nXPos, fYStart - (item.workingSet / fMax) * fHeightMul,
|
||||||
|
nXPos + fSecondStep * 2, fYStart - (lastItem.workingSet / fMax) * fHeightMul);
|
||||||
|
|
||||||
|
gfx.DrawLine(penGcReported, nXPos, fYStart - (item.gcReportedMem / fMax) * fHeightMul,
|
||||||
|
nXPos + fSecondStep * 2, fYStart - (lastItem.gcReportedMem / fMax) * fHeightMul);
|
||||||
|
|
||||||
|
if (nXPos < 0)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
lastItem = item;
|
||||||
|
if (item.nonpagedSystemMemory > fHighestRate)
|
||||||
|
fHighestRate = item.nonpagedSystemMemory;
|
||||||
|
if (item.pagedMemory > fHighestRate)
|
||||||
|
fHighestRate = item.pagedMemory;
|
||||||
|
if (item.pagedSystemMemory > fHighestRate)
|
||||||
|
fHighestRate = item.pagedSystemMemory;
|
||||||
|
if (item.workingSet > fHighestRate)
|
||||||
|
fHighestRate = item.workingSet;
|
||||||
|
if (item.gcReportedMem > fHighestRate)
|
||||||
|
fHighestRate = item.gcReportedMem;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < m_memStats.Height - 10; i += 30)
|
||||||
|
{
|
||||||
|
float yPos = m_memStats.Height - i - 15;
|
||||||
|
float fPos = ((float)(i)) / ((float)m_memStats.Height);
|
||||||
|
gfx.DrawString((fPos * fMax).ToString("##0.00") + " MB",
|
||||||
|
SystemFonts.DialogFont, Brushes.CadetBlue, 3, yPos);
|
||||||
|
}
|
||||||
|
|
||||||
|
int nPosX = m_memStats.Width - 120;
|
||||||
|
|
||||||
|
gfx.DrawString("Working set", SystemFonts.DialogFont, penWorkingSet.Brush, nPosX, 10);
|
||||||
|
gfx.DrawString("GC Reported mem.", SystemFonts.DialogFont, penGcReported.Brush, nPosX, 22);
|
||||||
|
gfx.DrawString("Paged mem.", SystemFonts.DialogFont, penPagedMemory.Brush, nPosX, 34);
|
||||||
|
gfx.DrawString("Paged system mem.", SystemFonts.DialogFont, penPagedSystemMemory.Brush, nPosX, 46);
|
||||||
|
gfx.DrawString("Nonpaged mem.", SystemFonts.DialogFont, penNonPagedMemory.Brush, nPosX, 58);
|
||||||
|
|
||||||
|
screenGfx.DrawImageUnscaled(backBuffer, 0, 0);
|
||||||
|
|
||||||
|
m_fMemoryHistoryScale = fHighestRate + 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
void RefreshNetworkStats(TrafficHistory item)
|
||||||
|
{
|
||||||
|
m_inUdpTraffic.Text = item.inUdpBytes.ToString("##0.00") + " KB/s";
|
||||||
|
m_outUdpTraffic.Text = item.outUdpBytes.ToString("##0.00") + " KB/s";
|
||||||
|
m_inTcpTraffic.Text = item.inTcpBytes.ToString("##0.00") + " KB/s";
|
||||||
|
m_outTcpTraffic.Text = item.outTcpBytes.ToString("##0.00") + " KB/s";
|
||||||
|
m_inTotalTraffic.Text = item.inTotalBytes.ToString("##0.00") + " KB/s";
|
||||||
|
m_outTotalTraffic.Text = item.outTotalBytes.ToString("##0.00") + " KB/s";
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void UpdateTimer(object sender, ElapsedEventArgs ea)
|
||||||
|
{
|
||||||
|
if (m_threads.InvokeRequired)
|
||||||
|
{
|
||||||
|
m_threads.Invoke(new UpdateControlsDelegate(UpdateControls));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
UpdateControls();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#region Thread items access
|
||||||
|
void UpdateThreadItem(ProcessThread pt)
|
||||||
|
{
|
||||||
|
if (m_threadItems.ContainsKey(pt.Id))
|
||||||
|
{
|
||||||
|
ThreadItem item = m_threadItems[pt.Id];
|
||||||
|
|
||||||
|
item.cpu.Text = pt.TotalProcessorTime.ToString();
|
||||||
|
if (m_idToName.ContainsKey(pt.Id))
|
||||||
|
{
|
||||||
|
item.name.Text = m_idToName[pt.Id];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ThreadItem item = new ThreadItem();
|
||||||
|
item.listItem = m_threads.Items.Add(pt.Id.ToString());
|
||||||
|
string name = "[n/a]";
|
||||||
|
if (m_idToName.ContainsKey(pt.Id))
|
||||||
|
{
|
||||||
|
name = m_idToName[pt.Id];
|
||||||
|
}
|
||||||
|
item.name = item.listItem.SubItems.Add(name);
|
||||||
|
item.cpu = item.listItem.SubItems.Add(pt.TotalProcessorTime.ToString());
|
||||||
|
|
||||||
|
m_threadItems[pt.Id] = item;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void RemoveThreadItems(List<int> removed)
|
||||||
|
{
|
||||||
|
foreach (int id in removed)
|
||||||
|
{
|
||||||
|
m_threads.Items.Remove(m_threadItems[id].listItem);
|
||||||
|
m_threadItems.Remove(id);
|
||||||
|
m_idToName.Remove(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void UpdateThreadList()
|
||||||
|
{
|
||||||
|
ProcessThreadCollection threads = Process.GetCurrentProcess().Threads;
|
||||||
|
|
||||||
|
lock (m_threadItems)
|
||||||
|
{
|
||||||
|
Dictionary<int, int> runningThreads = new Dictionary<int, int>();
|
||||||
|
|
||||||
|
foreach (ProcessThread pt in threads)
|
||||||
|
{
|
||||||
|
runningThreads[pt.Id] = 0;
|
||||||
|
|
||||||
|
UpdateThreadItem(pt);
|
||||||
|
}
|
||||||
|
|
||||||
|
List<int> removed = new List<int>();
|
||||||
|
foreach (int id in m_threadItems.Keys)
|
||||||
|
{
|
||||||
|
if (!runningThreads.ContainsKey(id))
|
||||||
|
{
|
||||||
|
removed.Add(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
RemoveThreadItems(removed);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,120 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
|
@ -300,8 +300,16 @@ namespace OpenSim.Framework.Servers
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
response.OutputStream.Flush();
|
||||||
response.OutputStream.Close();
|
response.OutputStream.Close();
|
||||||
}
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MainLog.Instance.Warn("HTTPD", "Error closing - " + ex.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void HandleLLSDRequests(HttpListenerRequest request, HttpListenerResponse response)
|
private void HandleLLSDRequests(HttpListenerRequest request, HttpListenerResponse response)
|
||||||
|
@ -352,8 +360,16 @@ namespace OpenSim.Framework.Servers
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
response.OutputStream.Flush();
|
||||||
response.OutputStream.Close();
|
response.OutputStream.Close();
|
||||||
}
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MainLog.Instance.Warn("HTTPD", "Error closing - " + ex.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void HandleHTTPRequest(HttpListenerRequest request, HttpListenerResponse response)
|
public void HandleHTTPRequest(HttpListenerRequest request, HttpListenerResponse response)
|
||||||
|
|
|
@ -48,6 +48,7 @@ namespace OpenSim.Framework
|
||||||
public bool HttpSSL = DefaultHttpSSL;
|
public bool HttpSSL = DefaultHttpSSL;
|
||||||
public uint DefaultX = 1000;
|
public uint DefaultX = 1000;
|
||||||
public uint DefaultY = 1000;
|
public uint DefaultY = 1000;
|
||||||
|
public bool RexMode = false;
|
||||||
|
|
||||||
private ConfigurationMember configMember;
|
private ConfigurationMember configMember;
|
||||||
|
|
||||||
|
@ -89,6 +90,8 @@ namespace OpenSim.Framework
|
||||||
"Known good region X", "1000", false);
|
"Known good region X", "1000", false);
|
||||||
configMember.addConfigurationOption("default_Y", ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
|
configMember.addConfigurationOption("default_Y", ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
|
||||||
"Known good region Y", "1000", false);
|
"Known good region Y", "1000", false);
|
||||||
|
configMember.addConfigurationOption("rex_mode", ConfigurationOption.ConfigurationTypes.TYPE_BOOLEAN,
|
||||||
|
"Run in realXtend mode? true/false", "false", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool handleIncomingConfiguration(string configuration_key, object configuration_result)
|
public bool handleIncomingConfiguration(string configuration_key, object configuration_result)
|
||||||
|
@ -125,6 +128,9 @@ namespace OpenSim.Framework
|
||||||
case "default_Y":
|
case "default_Y":
|
||||||
DefaultY = (uint) configuration_result;
|
DefaultY = (uint) configuration_result;
|
||||||
break;
|
break;
|
||||||
|
case "rex_mode":
|
||||||
|
RexMode = (bool)configuration_result;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -147,6 +147,12 @@ namespace OpenSim.Framework
|
||||||
/// The users last registered agent (filled in on the user server)
|
/// The users last registered agent (filled in on the user server)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public UserAgentData currentAgent;
|
public UserAgentData currentAgent;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Authentication address (used in rex mode)
|
||||||
|
/// </summary>
|
||||||
|
public string authenticationAddr;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -39,6 +39,39 @@ using Nini.Config;
|
||||||
|
|
||||||
namespace OpenSim.Framework
|
namespace OpenSim.Framework
|
||||||
{
|
{
|
||||||
|
// rex, new class
|
||||||
|
// Adds a way to get to the main ini file settings from anywhere
|
||||||
|
public sealed class GlobalSettings
|
||||||
|
{
|
||||||
|
private static volatile GlobalSettings instance;
|
||||||
|
private static object syncRoot = new Object();
|
||||||
|
|
||||||
|
public IniConfigSource ConfigSource;
|
||||||
|
|
||||||
|
public bool m_3d_collision_models = false;
|
||||||
|
|
||||||
|
public static GlobalSettings Instance
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (instance == null)
|
||||||
|
{
|
||||||
|
lock (syncRoot)
|
||||||
|
{
|
||||||
|
if (instance == null)
|
||||||
|
instance = new GlobalSettings();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public GlobalSettings()
|
||||||
|
{ }
|
||||||
|
}
|
||||||
|
// rex, end class
|
||||||
|
|
||||||
|
|
||||||
public class Util
|
public class Util
|
||||||
{
|
{
|
||||||
private static Random randomClass = new Random();
|
private static Random randomClass = new Random();
|
||||||
|
|
|
@ -10,10 +10,18 @@ namespace OpenSim.Grid.ScriptServer
|
||||||
{
|
{
|
||||||
// This object will be exposed over remoting. It is a singleton, so it exists only in as one instance.
|
// This object will be exposed over remoting. It is a singleton, so it exists only in as one instance.
|
||||||
|
|
||||||
|
// Expose ScriptEngine directly for now ... this is not very secure :)
|
||||||
|
// NOTE! CURRENTLY JUST HARDWIRED DOTNETENGINE!
|
||||||
|
//private OpenSim.Region.ScriptEngine.DotNetEngine.ScriptEngine SE =
|
||||||
|
// new OpenSim.Region.ScriptEngine.DotNetEngine.ScriptEngine();
|
||||||
|
//public OpenSim.Region.ScriptEngine.Common.ScriptServerInterfaces.RemoteEvents Events =
|
||||||
|
// (OpenSim.Region.ScriptEngine.Common.ScriptServerInterfaces.RemoteEvents)SE.m_EventManager;
|
||||||
|
|
||||||
|
//private ScriptServerInterfaces.RemoteEvents _events = new abc;
|
||||||
|
|
||||||
ScriptServerInterfaces.RemoteEvents ScriptServerInterfaces.ServerRemotingObject.Events()
|
ScriptServerInterfaces.RemoteEvents ScriptServerInterfaces.ServerRemotingObject.Events()
|
||||||
{
|
{
|
||||||
return ScriptServerMain.Engine.EventManager();
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,18 +4,17 @@ using System.Text;
|
||||||
using System.Runtime.Remoting;
|
using System.Runtime.Remoting;
|
||||||
using System.Runtime.Remoting.Channels;
|
using System.Runtime.Remoting.Channels;
|
||||||
using System.Runtime.Remoting.Channels.Tcp;
|
using System.Runtime.Remoting.Channels.Tcp;
|
||||||
using OpenSim.Region.ScriptEngine.Common;
|
|
||||||
|
|
||||||
|
|
||||||
namespace OpenSim.Grid.ScriptServer
|
namespace OpenSim.Grid.ScriptServer
|
||||||
{
|
{
|
||||||
class RemotingServer
|
class RemotingServer
|
||||||
{
|
{
|
||||||
TcpChannel channel;
|
|
||||||
public RemotingServer(int port, string instanceName)
|
public void CreateServer(int port, string instanceName)
|
||||||
{
|
{
|
||||||
// Create an instance of a channel
|
// Create an instance of a channel
|
||||||
channel = new TcpChannel(port);
|
TcpChannel channel = new TcpChannel(port);
|
||||||
ChannelServices.RegisterChannel(channel, true);
|
ChannelServices.RegisterChannel(channel, true);
|
||||||
|
|
||||||
// Register as an available service with the name HelloWorld
|
// Register as an available service with the name HelloWorld
|
||||||
|
|
|
@ -0,0 +1,38 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of the OpenSim Project nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
using OpenSim.Framework.Console;
|
||||||
|
|
||||||
|
namespace OpenSim.Grid.ScriptServer
|
||||||
|
{
|
||||||
|
public interface ScriptEngineInterface
|
||||||
|
{
|
||||||
|
void InitializeEngine(RegionConnectionManager Region, LogBase logger);
|
||||||
|
void Shutdown();
|
||||||
|
// void StartScript(string ScriptID, IScriptHost ObjectID);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,124 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of the OpenSim Project nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
using System.Reflection;
|
||||||
|
using OpenSim.Framework.Console;
|
||||||
|
|
||||||
|
namespace OpenSim.Grid.ScriptServer
|
||||||
|
{
|
||||||
|
internal class ScriptEngineLoader
|
||||||
|
{
|
||||||
|
private LogBase m_log;
|
||||||
|
|
||||||
|
|
||||||
|
public ScriptEngineLoader(LogBase logger)
|
||||||
|
{
|
||||||
|
m_log = logger;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ScriptEngineInterface LoadScriptEngine(string EngineName)
|
||||||
|
{
|
||||||
|
ScriptEngineInterface ret = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
ret =
|
||||||
|
LoadAndInitAssembly(
|
||||||
|
Path.Combine("ScriptEngines", "OpenSim.Region.ScriptEngine." + EngineName + ".dll"),
|
||||||
|
"OpenSim.Region.ScriptEngine." + EngineName + ".ScriptEngine");
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
m_log.Error("ScriptEngine",
|
||||||
|
"Error loading assembly \"" + EngineName + "\": " + e.Message + ", " +
|
||||||
|
e.StackTrace.ToString());
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Does actual loading and initialization of script Assembly
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="FreeAppDomain">AppDomain to load script into</param>
|
||||||
|
/// <param name="FileName">FileName of script assembly (.dll)</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
private ScriptEngineInterface LoadAndInitAssembly(string FileName, string NameSpace)
|
||||||
|
{
|
||||||
|
//Common.SendToDebug("Loading ScriptEngine Assembly " + FileName);
|
||||||
|
// Load .Net Assembly (.dll)
|
||||||
|
// Initialize and return it
|
||||||
|
|
||||||
|
// TODO: Add error handling
|
||||||
|
|
||||||
|
Assembly a;
|
||||||
|
//try
|
||||||
|
//{
|
||||||
|
|
||||||
|
|
||||||
|
// Load to default appdomain (temporary)
|
||||||
|
a = Assembly.LoadFrom(FileName);
|
||||||
|
// Load to specified appdomain
|
||||||
|
// TODO: Insert security
|
||||||
|
//a = FreeAppDomain.Load(FileName);
|
||||||
|
//}
|
||||||
|
//catch (Exception e)
|
||||||
|
//{
|
||||||
|
// m_log.Error("ScriptEngine", "Error loading assembly \"" + FileName + "\": " + e.ToString());
|
||||||
|
//}
|
||||||
|
|
||||||
|
|
||||||
|
//Console.WriteLine("Loading: " + FileName);
|
||||||
|
//foreach (Type _t in a.GetTypes())
|
||||||
|
//{
|
||||||
|
// Console.WriteLine("Type: " + _t.ToString());
|
||||||
|
//}
|
||||||
|
|
||||||
|
Type t;
|
||||||
|
//try
|
||||||
|
//{
|
||||||
|
t = a.GetType(NameSpace, true);
|
||||||
|
//}
|
||||||
|
//catch (Exception e)
|
||||||
|
//{
|
||||||
|
// m_log.Error("ScriptEngine", "Error initializing type \"" + NameSpace + "\" from \"" + FileName + "\": " + e.ToString());
|
||||||
|
//}
|
||||||
|
|
||||||
|
ScriptEngineInterface ret;
|
||||||
|
//try
|
||||||
|
//{
|
||||||
|
ret = (ScriptEngineInterface) Activator.CreateInstance(t);
|
||||||
|
//}
|
||||||
|
//catch (Exception e)
|
||||||
|
//{
|
||||||
|
// m_log.Error("ScriptEngine", "Error initializing type \"" + NameSpace + "\" from \"" + FileName + "\": " + e.ToString());
|
||||||
|
//}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -28,15 +28,14 @@
|
||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using OpenSim.Framework.Console;
|
using OpenSim.Framework.Console;
|
||||||
using OpenSim.Region.ScriptEngine.Common;
|
|
||||||
|
|
||||||
namespace OpenSim.Grid.ScriptServer.ScriptServer
|
namespace OpenSim.Grid.ScriptServer
|
||||||
{
|
{
|
||||||
internal class ScriptEngineManager
|
internal class ScriptEngineManager
|
||||||
{
|
{
|
||||||
private LogBase m_log;
|
private LogBase m_log;
|
||||||
private ScriptEngineLoader ScriptEngineLoader;
|
private ScriptEngineLoader ScriptEngineLoader;
|
||||||
private List<ScriptServerInterfaces.ScriptEngine> scriptEngines = new List<ScriptServerInterfaces.ScriptEngine>();
|
private List<ScriptEngineInterface> scriptEngines = new List<ScriptEngineInterface>();
|
||||||
private ScriptServerMain m_ScriptServerMain;
|
private ScriptServerMain m_ScriptServerMain;
|
||||||
|
|
||||||
// Initialize
|
// Initialize
|
||||||
|
@ -45,21 +44,23 @@ namespace OpenSim.Grid.ScriptServer.ScriptServer
|
||||||
m_ScriptServerMain = scm;
|
m_ScriptServerMain = scm;
|
||||||
m_log = logger;
|
m_log = logger;
|
||||||
ScriptEngineLoader = new ScriptEngineLoader(m_log);
|
ScriptEngineLoader = new ScriptEngineLoader(m_log);
|
||||||
|
|
||||||
|
// Temp - we should not load during initialize... Loading should be done later.
|
||||||
|
LoadEngine("DotNetScriptEngine");
|
||||||
}
|
}
|
||||||
|
|
||||||
~ScriptEngineManager()
|
~ScriptEngineManager()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public ScriptServerInterfaces.ScriptEngine LoadEngine(string engineName)
|
public void LoadEngine(string engineName)
|
||||||
{
|
{
|
||||||
// Load and add to list of ScriptEngines
|
// Load and add to list of ScriptEngines
|
||||||
ScriptServerInterfaces.ScriptEngine sei = ScriptEngineLoader.LoadScriptEngine(engineName);
|
ScriptEngineInterface sei = ScriptEngineLoader.LoadScriptEngine(engineName);
|
||||||
if (sei != null)
|
if (sei != null)
|
||||||
{
|
{
|
||||||
scriptEngines.Add(sei);
|
scriptEngines.Add(sei);
|
||||||
}
|
}
|
||||||
return sei;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -29,8 +29,6 @@
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Framework.Console;
|
using OpenSim.Framework.Console;
|
||||||
using OpenSim.Grid.ScriptServer.ScriptServer;
|
|
||||||
using OpenSim.Region.ScriptEngine.Common;
|
|
||||||
|
|
||||||
namespace OpenSim.Grid.ScriptServer
|
namespace OpenSim.Grid.ScriptServer
|
||||||
{
|
{
|
||||||
|
@ -43,26 +41,19 @@ namespace OpenSim.Grid.ScriptServer
|
||||||
private readonly string m_logFilename = ("region-console.log");
|
private readonly string m_logFilename = ("region-console.log");
|
||||||
private LogBase m_log;
|
private LogBase m_log;
|
||||||
|
|
||||||
// TEMP
|
|
||||||
public static ScriptServerInterfaces.ScriptEngine Engine;
|
|
||||||
|
|
||||||
// Objects we use
|
// Objects we use
|
||||||
internal RegionCommManager RegionScriptDaemon; // Listen for incoming from region
|
internal RegionCommManager RegionScriptDaemon; // Listen for incoming from region
|
||||||
internal ScriptEngineManager ScriptEngines; // Loads scriptengines
|
//internal ScriptEngineManager ScriptEngines; // Loads scriptengines
|
||||||
internal RemotingServer m_RemotingServer;
|
internal RemotingServer m_RemotingServer;
|
||||||
|
|
||||||
public ScriptServerMain()
|
public ScriptServerMain()
|
||||||
{
|
{
|
||||||
m_log = CreateLog();
|
m_log = CreateLog();
|
||||||
|
|
||||||
// Set up script engine mananger
|
RegionScriptDaemon = new RegionCommManager(this, m_log);
|
||||||
ScriptEngines = new ScriptEngineManager(this, m_log);
|
//ScriptEngines = new ScriptEngineManager(this, m_log);
|
||||||
|
m_RemotingServer = new RemotingServer();
|
||||||
// Load DotNetEngine
|
m_RemotingServer.CreateServer(listenPort, "DotNetEngine");
|
||||||
Engine = ScriptEngines.LoadEngine("DotNetEngine");
|
|
||||||
|
|
||||||
// Set up server
|
|
||||||
m_RemotingServer = new RemotingServer(listenPort, "DotNetEngine");
|
|
||||||
System.Console.ReadLine();
|
System.Console.ReadLine();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,7 +68,7 @@ namespace OpenSim.Grid.ScriptServer
|
||||||
Directory.CreateDirectory(Util.logDir());
|
Directory.CreateDirectory(Util.logDir());
|
||||||
}
|
}
|
||||||
|
|
||||||
return new LogBase((Path.Combine(Util.logDir(), m_logFilename)), "ScriptServer", this, true);
|
return new LogBase((Path.Combine(Util.logDir(), m_logFilename)), "Region", this, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RunCmd(string command, string[] cmdparams)
|
public void RunCmd(string command, string[] cmdparams)
|
||||||
|
|
|
@ -28,12 +28,14 @@
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Collections;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using libsecondlife;
|
using libsecondlife;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Framework.Communications.Cache;
|
using OpenSim.Framework.Communications.Cache;
|
||||||
using OpenSim.Framework.Console;
|
using OpenSim.Framework.Console;
|
||||||
using OpenSim.Framework.Servers;
|
using OpenSim.Framework.Servers;
|
||||||
|
using Nwc.XmlRpc;
|
||||||
|
|
||||||
namespace OpenSim.Grid.UserServer
|
namespace OpenSim.Grid.UserServer
|
||||||
{
|
{
|
||||||
|
@ -51,6 +53,8 @@ namespace OpenSim.Grid.UserServer
|
||||||
private LogBase m_console;
|
private LogBase m_console;
|
||||||
private LLUUID m_lastCreatedUser = LLUUID.Random();
|
private LLUUID m_lastCreatedUser = LLUUID.Random();
|
||||||
|
|
||||||
|
private Boolean m_rexMode;
|
||||||
|
|
||||||
[STAThread]
|
[STAThread]
|
||||||
public static void Main(string[] args)
|
public static void Main(string[] args)
|
||||||
{
|
{
|
||||||
|
@ -94,6 +98,7 @@ namespace OpenSim.Grid.UserServer
|
||||||
|
|
||||||
m_loginService = new UserLoginService(
|
m_loginService = new UserLoginService(
|
||||||
m_userManager, new LibraryRootFolder(), Cfg, Cfg.DefaultStartupMsg);
|
m_userManager, new LibraryRootFolder(), Cfg, Cfg.DefaultStartupMsg);
|
||||||
|
m_rexMode = Cfg.RexMode;
|
||||||
|
|
||||||
m_messagesService = new MessageServersConnector(MainLog.Instance);
|
m_messagesService = new MessageServersConnector(MainLog.Instance);
|
||||||
|
|
||||||
|
@ -106,6 +111,7 @@ namespace OpenSim.Grid.UserServer
|
||||||
|
|
||||||
httpServer.SetLLSDHandler(m_loginService.LLSDLoginMethod);
|
httpServer.SetLLSDHandler(m_loginService.LLSDLoginMethod);
|
||||||
|
|
||||||
|
if (!m_rexMode) {
|
||||||
httpServer.AddXmlRPCHandler("get_user_by_name", m_userManager.XmlRPCGetUserMethodName);
|
httpServer.AddXmlRPCHandler("get_user_by_name", m_userManager.XmlRPCGetUserMethodName);
|
||||||
httpServer.AddXmlRPCHandler("get_user_by_uuid", m_userManager.XmlRPCGetUserMethodUUID);
|
httpServer.AddXmlRPCHandler("get_user_by_uuid", m_userManager.XmlRPCGetUserMethodUUID);
|
||||||
httpServer.AddXmlRPCHandler("get_avatar_picker_avatar", m_userManager.XmlRPCGetAvatarPickerAvatar);
|
httpServer.AddXmlRPCHandler("get_avatar_picker_avatar", m_userManager.XmlRPCGetAvatarPickerAvatar);
|
||||||
|
@ -118,7 +124,21 @@ namespace OpenSim.Grid.UserServer
|
||||||
httpServer.AddXmlRPCHandler("register_messageserver", m_messagesService.XmlRPCRegisterMessageServer);
|
httpServer.AddXmlRPCHandler("register_messageserver", m_messagesService.XmlRPCRegisterMessageServer);
|
||||||
httpServer.AddXmlRPCHandler("agent_change_region", m_messagesService.XmlRPCUserMovedtoRegion);
|
httpServer.AddXmlRPCHandler("agent_change_region", m_messagesService.XmlRPCUserMovedtoRegion);
|
||||||
httpServer.AddXmlRPCHandler("deregister_messageserver", m_messagesService.XmlRPCDeRegisterMessageServer);
|
httpServer.AddXmlRPCHandler("deregister_messageserver", m_messagesService.XmlRPCDeRegisterMessageServer);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
httpServer.AddXmlRPCHandler("get_user_by_name", new RexRemoteHandler("get_user_by_name").rexRemoteXmlRPCHandler);
|
||||||
|
httpServer.AddXmlRPCHandler("get_user_by_uuid", new RexRemoteHandler("get_user_by_uuid").rexRemoteXmlRPCHandler);
|
||||||
|
httpServer.AddXmlRPCHandler("get_avatar_picker_avatar", new RexRemoteHandler("get_avatar_picker_avatar").rexRemoteXmlRPCHandler);
|
||||||
|
httpServer.AddXmlRPCHandler("add_new_user_friend", new RexRemoteHandler("add_new_user_friend").rexRemoteXmlRPCHandler);
|
||||||
|
httpServer.AddXmlRPCHandler("remove_user_friend", new RexRemoteHandler("remove_user_friend").rexRemoteXmlRPCHandler);
|
||||||
|
httpServer.AddXmlRPCHandler("update_user_friend_perms", new RexRemoteHandler("update_user_friend_perms").rexRemoteXmlRPCHandler);
|
||||||
|
httpServer.AddXmlRPCHandler("get_user_friend_list", new RexRemoteHandler("get_user_friend_list").rexRemoteXmlRPCHandler);
|
||||||
|
|
||||||
|
// Message Server ---> User Server
|
||||||
|
httpServer.AddXmlRPCHandler("register_messageserver", new RexRemoteHandler("register_messageserver").rexRemoteXmlRPCHandler);
|
||||||
|
httpServer.AddXmlRPCHandler("agent_change_region", new RexRemoteHandler("agent_change_region").rexRemoteXmlRPCHandler);
|
||||||
|
httpServer.AddXmlRPCHandler("deregister_messageserver", new RexRemoteHandler("deregister_messageserver").rexRemoteXmlRPCHandler);
|
||||||
|
}
|
||||||
|
|
||||||
httpServer.AddStreamHandler(
|
httpServer.AddStreamHandler(
|
||||||
new RestStreamHandler("DELETE", "/usersessions/", m_userManager.RestDeleteUserSessionMethod));
|
new RestStreamHandler("DELETE", "/usersessions/", m_userManager.RestDeleteUserSessionMethod));
|
||||||
|
@ -241,4 +261,55 @@ namespace OpenSim.Grid.UserServer
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// for forwarding some requests to authentication server
|
||||||
|
/// </summary>
|
||||||
|
class RexRemoteHandler
|
||||||
|
{
|
||||||
|
private string methodName;
|
||||||
|
|
||||||
|
public RexRemoteHandler(String method)
|
||||||
|
{
|
||||||
|
methodName = method;
|
||||||
|
}
|
||||||
|
|
||||||
|
public XmlRpcResponse rexRemoteXmlRPCHandler(XmlRpcRequest request)
|
||||||
|
{
|
||||||
|
Hashtable requestData = (Hashtable)request.Params[0];
|
||||||
|
string authAddr;
|
||||||
|
if (requestData.Contains("AuthenticationAddress") && requestData["AuthenticationAddress"] != null)
|
||||||
|
{
|
||||||
|
authAddr = (string)requestData["AuthenticationAddress"];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return CreateErrorResponse("unknown_authentication",
|
||||||
|
"Request did not contain authentication address");
|
||||||
|
}
|
||||||
|
|
||||||
|
ArrayList SendParams = new ArrayList();
|
||||||
|
foreach (Object obj in request.Params)
|
||||||
|
{
|
||||||
|
SendParams.Add(obj);
|
||||||
|
}
|
||||||
|
XmlRpcRequest req = new XmlRpcRequest(methodName, SendParams);
|
||||||
|
if(!authAddr.StartsWith("http://"))
|
||||||
|
authAddr = "http://"+ authAddr;
|
||||||
|
XmlRpcResponse res = req.Send(authAddr, 30000);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
public XmlRpcResponse CreateErrorResponse(string type, string desc)
|
||||||
|
{
|
||||||
|
XmlRpcResponse response = new XmlRpcResponse();
|
||||||
|
Hashtable responseData = new Hashtable();
|
||||||
|
responseData["error_type"] = type;
|
||||||
|
responseData["error_desc"] = desc;
|
||||||
|
|
||||||
|
response.Value = responseData;
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,7 +54,7 @@ namespace OpenSim.Grid.UserServer
|
||||||
|
|
||||||
public UserLoginService(
|
public UserLoginService(
|
||||||
UserManagerBase userManager, LibraryRootFolder libraryRootFolder, UserConfig config, string welcomeMess)
|
UserManagerBase userManager, LibraryRootFolder libraryRootFolder, UserConfig config, string welcomeMess)
|
||||||
: base(userManager, libraryRootFolder, welcomeMess)
|
: base(userManager, libraryRootFolder, welcomeMess, config.RexMode)
|
||||||
{
|
{
|
||||||
m_config = config;
|
m_config = config;
|
||||||
}
|
}
|
||||||
|
@ -64,7 +64,7 @@ namespace OpenSim.Grid.UserServer
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="response">The existing response</param>
|
/// <param name="response">The existing response</param>
|
||||||
/// <param name="theUser">The user profile</param>
|
/// <param name="theUser">The user profile</param>
|
||||||
public override void CustomiseResponse(LoginResponse response, UserProfileData theUser)
|
public override void CustomiseResponse(LoginResponse response, UserProfileData theUser, string ASaddress)
|
||||||
{
|
{
|
||||||
bool tryDefault = false;
|
bool tryDefault = false;
|
||||||
//CFK: Since the try is always "tried", the "Home Location" message should always appear, so comment this one.
|
//CFK: Since the try is always "tried", the "Home Location" message should always appear, so comment this one.
|
||||||
|
@ -119,6 +119,12 @@ namespace OpenSim.Grid.UserServer
|
||||||
SimParams["startpos_z"] = theUser.currentAgent.currentPos.Z.ToString();
|
SimParams["startpos_z"] = theUser.currentAgent.currentPos.Z.ToString();
|
||||||
SimParams["regionhandle"] = theUser.currentAgent.currentHandle.ToString();
|
SimParams["regionhandle"] = theUser.currentAgent.currentHandle.ToString();
|
||||||
SimParams["caps_path"] = capsPath;
|
SimParams["caps_path"] = capsPath;
|
||||||
|
if (m_rexMode)
|
||||||
|
{
|
||||||
|
SimParams["auth_addr"] = theUser.authenticationAddr;
|
||||||
|
SimParams["as_addr"] = ASaddress;
|
||||||
|
}
|
||||||
|
|
||||||
ArrayList SendParams = new ArrayList();
|
ArrayList SendParams = new ArrayList();
|
||||||
SendParams.Add(SimParams);
|
SendParams.Add(SimParams);
|
||||||
|
|
||||||
|
@ -196,6 +202,12 @@ namespace OpenSim.Grid.UserServer
|
||||||
SimParams["startpos_z"] = theUser.currentAgent.currentPos.Z.ToString();
|
SimParams["startpos_z"] = theUser.currentAgent.currentPos.Z.ToString();
|
||||||
SimParams["regionhandle"] = theUser.currentAgent.currentHandle.ToString();
|
SimParams["regionhandle"] = theUser.currentAgent.currentHandle.ToString();
|
||||||
SimParams["caps_path"] = capsPath;
|
SimParams["caps_path"] = capsPath;
|
||||||
|
if (m_rexMode)
|
||||||
|
{
|
||||||
|
SimParams["auth_addr"] = theUser.authenticationAddr;
|
||||||
|
SimParams["as_addr"] = ASaddress;
|
||||||
|
}
|
||||||
|
|
||||||
ArrayList SendParams = new ArrayList();
|
ArrayList SendParams = new ArrayList();
|
||||||
SendParams.Add(SimParams);
|
SendParams.Add(SimParams);
|
||||||
|
|
||||||
|
|
|
@ -263,7 +263,7 @@ namespace OpenSim.Grid.UserServer
|
||||||
|
|
||||||
if (querysplit.Length == 2)
|
if (querysplit.Length == 2)
|
||||||
{
|
{
|
||||||
userProfile = GetUserProfile(querysplit[0], querysplit[1]);
|
userProfile = GetUserProfile(querysplit[0], querysplit[1], "");
|
||||||
if (userProfile == null)
|
if (userProfile == null)
|
||||||
{
|
{
|
||||||
return CreateUnknownUserErrorResponse();
|
return CreateUnknownUserErrorResponse();
|
||||||
|
@ -291,17 +291,28 @@ namespace OpenSim.Grid.UserServer
|
||||||
//CFK: Console.WriteLine("METHOD BY UUID CALLED");
|
//CFK: Console.WriteLine("METHOD BY UUID CALLED");
|
||||||
if (requestData.Contains("avatar_uuid"))
|
if (requestData.Contains("avatar_uuid"))
|
||||||
{
|
{
|
||||||
|
|
||||||
LLUUID guess = new LLUUID();
|
LLUUID guess = new LLUUID();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
guess = new LLUUID((string) requestData["avatar_uuid"]);
|
guess = new LLUUID((string)requestData["avatar_uuid"]);
|
||||||
|
//userProfile = GetUserProfile(guess);
|
||||||
userProfile = GetUserProfile(guess);
|
string authAddr;
|
||||||
|
if (requestData["AuthenticationAddress"] == null)
|
||||||
|
authAddr = "";
|
||||||
|
else
|
||||||
|
authAddr = requestData["AuthenticationAddress"].ToString();
|
||||||
|
userProfile = GetUserProfile(guess, authAddr);
|
||||||
}
|
}
|
||||||
catch (FormatException)
|
catch (FormatException)
|
||||||
{
|
{
|
||||||
return CreateUnknownUserErrorResponse();
|
return CreateUnknownUserErrorResponse();
|
||||||
}
|
}
|
||||||
|
catch (NullReferenceException)
|
||||||
|
{
|
||||||
|
Console.WriteLine("NullReferenceException occured");
|
||||||
|
return CreateUnknownUserErrorResponse();
|
||||||
|
}
|
||||||
|
|
||||||
if (userProfile == null)
|
if (userProfile == null)
|
||||||
{
|
{
|
||||||
|
|
|
@ -93,6 +93,8 @@ namespace OpenSim
|
||||||
public ConsoleCommand CreateAccount = null;
|
public ConsoleCommand CreateAccount = null;
|
||||||
private bool m_dumpAssetsToFile;
|
private bool m_dumpAssetsToFile;
|
||||||
|
|
||||||
|
private bool m_rexMode = false; //rex
|
||||||
|
|
||||||
private List<IApplicationPlugin> m_plugins = new List<IApplicationPlugin>();
|
private List<IApplicationPlugin> m_plugins = new List<IApplicationPlugin>();
|
||||||
|
|
||||||
private IniConfigSource m_config;
|
private IniConfigSource m_config;
|
||||||
|
@ -153,6 +155,9 @@ namespace OpenSim
|
||||||
}
|
}
|
||||||
|
|
||||||
ReadConfigSettings();
|
ReadConfigSettings();
|
||||||
|
// rex, added globalconfig for easy access to config values outside OpenSimMain without using parameters.
|
||||||
|
GlobalSettings.Instance.ConfigSource = m_config;
|
||||||
|
GlobalSettings.Instance.m_3d_collision_models = m_config.Configs["Startup"].GetBoolean("3d_collision_models", true); // endrex
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IConfigSource DefaultConfig()
|
public static IConfigSource DefaultConfig()
|
||||||
|
@ -175,6 +180,10 @@ namespace OpenSim
|
||||||
config.Set("shutdown_console_commands_file", "");
|
config.Set("shutdown_console_commands_file", "");
|
||||||
config.Set("script_engine", "OpenSim.Region.ScriptEngine.DotNetEngine.dll");
|
config.Set("script_engine", "OpenSim.Region.ScriptEngine.DotNetEngine.dll");
|
||||||
config.Set("asset_database", "sqlite");
|
config.Set("asset_database", "sqlite");
|
||||||
|
config.Set("worldlibraryfolder", true); // rex, added
|
||||||
|
config.Set("replace_assets", true); // rex, added
|
||||||
|
config.Set("rex_mode", false); //rex
|
||||||
|
config.Set("3d_collision_models", true); //rex
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DefaultConfig.Configs["StandAlone"] == null)
|
if (DefaultConfig.Configs["StandAlone"] == null)
|
||||||
|
@ -251,6 +260,7 @@ namespace OpenSim
|
||||||
m_assetStorage = startupConfig.GetString("asset_database", "sqlite");
|
m_assetStorage = startupConfig.GetString("asset_database", "sqlite");
|
||||||
|
|
||||||
m_timedScript = startupConfig.GetString("timer_Script", "disabled");
|
m_timedScript = startupConfig.GetString("timer_Script", "disabled");
|
||||||
|
m_rexMode = startupConfig.GetBoolean("rex_mode", false);//rex
|
||||||
}
|
}
|
||||||
|
|
||||||
IConfig standaloneConfig = m_config.Configs["StandAlone"];
|
IConfig standaloneConfig = m_config.Configs["StandAlone"];
|
||||||
|
@ -320,10 +330,11 @@ namespace OpenSim
|
||||||
|
|
||||||
m_loginService =
|
m_loginService =
|
||||||
new LocalLoginService(userService, m_standaloneWelcomeMessage, localComms, m_networkServersInfo,
|
new LocalLoginService(userService, m_standaloneWelcomeMessage, localComms, m_networkServersInfo,
|
||||||
m_standaloneAuthenticate);
|
m_standaloneAuthenticate, m_rexMode);
|
||||||
m_loginService.OnLoginToRegion += backendService.AddNewSession;
|
m_loginService.OnLoginToRegion += backendService.AddNewSession;
|
||||||
|
|
||||||
m_httpServer.AddXmlRPCHandler("login_to_simulator", m_loginService.XmlRpcLoginMethod);
|
m_httpServer.AddXmlRPCHandler("login_to_simulator", m_loginService.XmlRpcLoginMethod);
|
||||||
|
|
||||||
m_httpServer.SetLLSDHandler(m_loginService.LLSDLoginMethod);
|
m_httpServer.SetLLSDHandler(m_loginService.LLSDLoginMethod);
|
||||||
|
|
||||||
if (m_standaloneAuthenticate)
|
if (m_standaloneAuthenticate)
|
||||||
|
@ -434,6 +445,8 @@ namespace OpenSim
|
||||||
MainLog.Instance.Verbose("MODULES", "Loading scripting engine modules");
|
MainLog.Instance.Verbose("MODULES", "Loading scripting engine modules");
|
||||||
m_moduleLoader.LoadRegionModules(Path.Combine("ScriptEngines", m_scriptEngine), scene);
|
m_moduleLoader.LoadRegionModules(Path.Combine("ScriptEngines", m_scriptEngine), scene);
|
||||||
|
|
||||||
|
m_moduleLoader.LoadRegionModules(Path.Combine("ScriptEngines", "OpenSim.Region.RexScriptModule.dll"), scene); // rex
|
||||||
|
|
||||||
m_moduleLoader.InitialiseSharedModules(scene);
|
m_moduleLoader.InitialiseSharedModules(scene);
|
||||||
scene.SetModuleInterfaces();
|
scene.SetModuleInterfaces();
|
||||||
|
|
||||||
|
@ -476,7 +489,8 @@ namespace OpenSim
|
||||||
return
|
return
|
||||||
new Scene(regionInfo, circuitManager, permissionManager, m_commsManager, sceneGridService, m_assetCache,
|
new Scene(regionInfo, circuitManager, permissionManager, m_commsManager, sceneGridService, m_assetCache,
|
||||||
storageManager, m_httpServer,
|
storageManager, m_httpServer,
|
||||||
m_moduleLoader, m_dumpAssetsToFile, m_physicalPrim, m_SendChildAgentTaskData);
|
m_moduleLoader, m_dumpAssetsToFile, m_physicalPrim, m_SendChildAgentTaskData,
|
||||||
|
m_rexMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -682,6 +696,7 @@ namespace OpenSim
|
||||||
m_log.Error("show uptime - show simulator startup and uptime.");
|
m_log.Error("show uptime - show simulator startup and uptime.");
|
||||||
m_log.Error("show users - show info about connected users.");
|
m_log.Error("show users - show info about connected users.");
|
||||||
m_log.Error("show modules - shows info aboutloaded modules.");
|
m_log.Error("show modules - shows info aboutloaded modules.");
|
||||||
|
m_log.Error("status - show status window"); //rex
|
||||||
m_log.Error("shutdown - disconnect all clients and shutdown.");
|
m_log.Error("shutdown - disconnect all clients and shutdown.");
|
||||||
m_log.Error("terrain help - show help for terrain commands.");
|
m_log.Error("terrain help - show help for terrain commands.");
|
||||||
break;
|
break;
|
||||||
|
@ -863,6 +878,22 @@ namespace OpenSim
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
// rex, new console command.
|
||||||
|
case "save-db":
|
||||||
|
MainLog.Instance.Verbose("COMMANDFILE", "Forced database save started...");
|
||||||
|
m_sceneManager.ForcedBackupCurrentScene();
|
||||||
|
MainLog.Instance.Verbose("COMMANDFILE", "Forced database save ended...");
|
||||||
|
break;
|
||||||
|
// rex, new console command.
|
||||||
|
case "python":
|
||||||
|
m_sceneManager.SendPythonScriptCommand(cmdparams);
|
||||||
|
break;
|
||||||
|
|
||||||
|
//rex
|
||||||
|
case "status":
|
||||||
|
OpenSim.Framework.ServerStatus.ServerStatus.ShowWindow();
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
m_log.Error("Unknown command");
|
m_log.Error("Unknown command");
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -55,6 +55,7 @@ namespace OpenSim.Region.ClientStack
|
||||||
public static TerrainManager TerrainManager;
|
public static TerrainManager TerrainManager;
|
||||||
|
|
||||||
/* private variables */
|
/* private variables */
|
||||||
|
private bool m_running = true;
|
||||||
private readonly LLUUID m_sessionId;
|
private readonly LLUUID m_sessionId;
|
||||||
private LLUUID m_secureSessionId = LLUUID.Zero;
|
private LLUUID m_secureSessionId = LLUUID.Zero;
|
||||||
//private AgentAssetUpload UploadAssets;
|
//private AgentAssetUpload UploadAssets;
|
||||||
|
@ -73,6 +74,12 @@ namespace OpenSim.Region.ClientStack
|
||||||
private readonly uint m_circuitCode;
|
private readonly uint m_circuitCode;
|
||||||
private int m_moneyBalance;
|
private int m_moneyBalance;
|
||||||
|
|
||||||
|
private string m_clientVersion = "not set"; //rex
|
||||||
|
private bool m_rexClient = false; //rex
|
||||||
|
|
||||||
|
//Rex: Used to identify which materials have already been processed for mediaurl
|
||||||
|
private Dictionary<LLUUID, string> m_sentMediaUrls;
|
||||||
|
|
||||||
private readonly byte[] m_channelVersion = new byte[] { 0x00 }; // Dummy value needed by libSL
|
private readonly byte[] m_channelVersion = new byte[] { 0x00 }; // Dummy value needed by libSL
|
||||||
|
|
||||||
/* protected variables */
|
/* protected variables */
|
||||||
|
@ -85,7 +92,7 @@ namespace OpenSim.Region.ClientStack
|
||||||
protected IScene m_scene;
|
protected IScene m_scene;
|
||||||
protected AgentCircuitManager m_authenticateSessionsHandler;
|
protected AgentCircuitManager m_authenticateSessionsHandler;
|
||||||
|
|
||||||
protected PacketQueue m_packetQueue;
|
protected RexPacketQueue m_packetQueue;
|
||||||
|
|
||||||
protected Dictionary<uint, uint> m_pendingAcks = new Dictionary<uint, uint>();
|
protected Dictionary<uint, uint> m_pendingAcks = new Dictionary<uint, uint>();
|
||||||
protected Dictionary<uint, Packet> m_needAck = new Dictionary<uint, Packet>();
|
protected Dictionary<uint, Packet> m_needAck = new Dictionary<uint, Packet>();
|
||||||
|
@ -182,6 +189,8 @@ namespace OpenSim.Region.ClientStack
|
||||||
{
|
{
|
||||||
m_moneyBalance = 1000;
|
m_moneyBalance = 1000;
|
||||||
|
|
||||||
|
m_sentMediaUrls = new Dictionary<LLUUID, string>(); //rex
|
||||||
|
|
||||||
m_scene = scene;
|
m_scene = scene;
|
||||||
m_assetCache = assetCache;
|
m_assetCache = assetCache;
|
||||||
|
|
||||||
|
@ -189,8 +198,6 @@ namespace OpenSim.Region.ClientStack
|
||||||
// m_inventoryCache = inventoryCache;
|
// m_inventoryCache = inventoryCache;
|
||||||
m_authenticateSessionsHandler = authenSessions;
|
m_authenticateSessionsHandler = authenSessions;
|
||||||
|
|
||||||
MainLog.Instance.Verbose("CLIENT", "Started up new client thread to handle incoming request");
|
|
||||||
|
|
||||||
m_agentId = agentId;
|
m_agentId = agentId;
|
||||||
m_sessionId = sessionId;
|
m_sessionId = sessionId;
|
||||||
m_circuitCode = circuitCode;
|
m_circuitCode = circuitCode;
|
||||||
|
@ -204,7 +211,21 @@ namespace OpenSim.Region.ClientStack
|
||||||
// in it to process. It's an on-purpose threadlock though because
|
// in it to process. It's an on-purpose threadlock though because
|
||||||
// without it, the clientloop will suck up all sim resources.
|
// without it, the clientloop will suck up all sim resources.
|
||||||
|
|
||||||
m_packetQueue = new PacketQueue();
|
//REX: Get options from ini, otherwise run on LAN bandwidth settings
|
||||||
|
if (GlobalSettings.Instance.ConfigSource.Configs["Startup"].Contains("bandwidth_start") &&
|
||||||
|
GlobalSettings.Instance.ConfigSource.Configs["Startup"].Contains("bandwidth_max") &&
|
||||||
|
GlobalSettings.Instance.ConfigSource.Configs["Startup"].Contains("bandwidth_min"))
|
||||||
|
{
|
||||||
|
m_packetQueue = new RexPacketQueue(
|
||||||
|
GlobalSettings.Instance.ConfigSource.Configs["Network"].GetInt("bandwidth_start"),
|
||||||
|
GlobalSettings.Instance.ConfigSource.Configs["Network"].GetInt("bandwidth_max"),
|
||||||
|
GlobalSettings.Instance.ConfigSource.Configs["Network"].GetInt("bandwidth_min"));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//Default to very large values (LAN)
|
||||||
|
m_packetQueue = new RexPacketQueue(10000000, 10000000, 100000);
|
||||||
|
}
|
||||||
|
|
||||||
RegisterLocalPacketHandlers();
|
RegisterLocalPacketHandlers();
|
||||||
|
|
||||||
|
@ -221,8 +242,18 @@ namespace OpenSim.Region.ClientStack
|
||||||
# region Client Methods
|
# region Client Methods
|
||||||
|
|
||||||
private void CloseCleanup()
|
private void CloseCleanup()
|
||||||
|
{
|
||||||
|
|
||||||
|
if (!m_scene.RexMode)
|
||||||
{
|
{
|
||||||
m_scene.RemoveClient(AgentId);
|
m_scene.RemoveClient(AgentId);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_scene.RemoveClient(AgentId, m_circuitCode);
|
||||||
|
}
|
||||||
|
//m_scene.RemoveClient(AgentId);
|
||||||
|
|
||||||
// Send the STOP packet
|
// Send the STOP packet
|
||||||
DisableSimulatorPacket disable = (DisableSimulatorPacket)PacketPool.Instance.GetPacket(PacketType.DisableSimulator);
|
DisableSimulatorPacket disable = (DisableSimulatorPacket)PacketPool.Instance.GetPacket(PacketType.DisableSimulator);
|
||||||
OutPacket(disable, ThrottleOutPacketType.Task);
|
OutPacket(disable, ThrottleOutPacketType.Task);
|
||||||
|
@ -368,9 +399,65 @@ namespace OpenSim.Region.ClientStack
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void SendSkyboxInformation()
|
||||||
|
{
|
||||||
|
RexSkyboxInfoPacket packet = new RexSkyboxInfoPacket();
|
||||||
|
|
||||||
|
string skyboxFront = GlobalSettings.Instance.ConfigSource.Configs["Startup"].
|
||||||
|
GetString("skybox_front", "00000000-0000-0000-0000-000000000000");
|
||||||
|
string skyboxBack = GlobalSettings.Instance.ConfigSource.Configs["Startup"].
|
||||||
|
GetString("skybox_back", "00000000-0000-0000-0000-000000000000");
|
||||||
|
string skyboxLeft = GlobalSettings.Instance.ConfigSource.Configs["Startup"].
|
||||||
|
GetString("skybox_left", "00000000-0000-0000-0000-000000000000");
|
||||||
|
string skyboxRight = GlobalSettings.Instance.ConfigSource.Configs["Startup"].
|
||||||
|
GetString("skybox_right", "00000000-0000-0000-0000-000000000000");
|
||||||
|
string skyboxTop = GlobalSettings.Instance.ConfigSource.Configs["Startup"].
|
||||||
|
GetString("skybox_top", "00000000-0000-0000-0000-000000000000");
|
||||||
|
string skyboxBottom = GlobalSettings.Instance.ConfigSource.Configs["Startup"].
|
||||||
|
GetString("skybox_bottom", "00000000-0000-0000-0000-000000000000");
|
||||||
|
|
||||||
|
|
||||||
|
//Make sure the skybox textures are actually all set before sending the packet
|
||||||
|
if (skyboxFront == "00000000-0000-0000-0000-000000000000" ||
|
||||||
|
skyboxBack == "00000000-0000-0000-0000-000000000000" ||
|
||||||
|
skyboxLeft == "00000000-0000-0000-0000-000000000000" ||
|
||||||
|
skyboxRight == "00000000-0000-0000-0000-000000000000" ||
|
||||||
|
skyboxTop == "00000000-0000-0000-0000-000000000000" ||
|
||||||
|
skyboxBottom == "00000000-0000-0000-0000-000000000000")
|
||||||
|
{
|
||||||
|
//No textures set, don't send
|
||||||
|
MainLog.Instance.Warn("CLIENT", "Some of the skybox textures were not set");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
MainLog.Instance.Verbose("CLIENT", "REX: Sending skybox data");
|
||||||
|
|
||||||
|
packet.Textures.FrontTextureID = new LLUUID(skyboxFront);
|
||||||
|
packet.Textures.BackTextureID = new LLUUID(skyboxBack);
|
||||||
|
packet.Textures.LeftTextureID = new LLUUID(skyboxLeft);
|
||||||
|
packet.Textures.RightTextureID = new LLUUID(skyboxRight);
|
||||||
|
packet.Textures.TopTextureID = new LLUUID(skyboxTop);
|
||||||
|
packet.Textures.BottomTextureID = new LLUUID(skyboxBottom);
|
||||||
|
packet.Header.Reliable = true;
|
||||||
|
|
||||||
|
OutPacket(packet, ThrottleOutPacketType.Asset);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void SendRexInformation()
|
||||||
|
{
|
||||||
|
MainLog.Instance.Verbose("CLIENT", "REX: Sending rexregion information");
|
||||||
|
SendSkyboxInformation();
|
||||||
|
}
|
||||||
|
|
||||||
protected virtual void ClientLoop()
|
protected virtual void ClientLoop()
|
||||||
{
|
{
|
||||||
MainLog.Instance.Verbose("CLIENT", "Entered loop");
|
MainLog.Instance.Verbose("CLIENT", "Entered loop");
|
||||||
|
|
||||||
|
//REX: Send all rexregion related information
|
||||||
|
if (m_rexClient)
|
||||||
|
{
|
||||||
|
SendRexInformation();
|
||||||
|
}
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
QueItem nextPacket = m_packetQueue.Dequeue();
|
QueItem nextPacket = m_packetQueue.Dequeue();
|
||||||
|
@ -434,7 +521,13 @@ namespace OpenSim.Region.ClientStack
|
||||||
m_clientPingTimer.Elapsed += new ElapsedEventHandler(CheckClientConnectivity);
|
m_clientPingTimer.Elapsed += new ElapsedEventHandler(CheckClientConnectivity);
|
||||||
m_clientPingTimer.Enabled = true;
|
m_clientPingTimer.Enabled = true;
|
||||||
|
|
||||||
MainLog.Instance.Verbose("CLIENT", "Adding viewer agent to scene");
|
MainLog.Instance.Verbose("CLIENT", "Adding viewer agent to scene (version: " + m_clientVersion + ")");
|
||||||
|
|
||||||
|
if (m_clientVersion != null && m_clientVersion.Contains("realXtend"))
|
||||||
|
{
|
||||||
|
m_rexClient = true;
|
||||||
|
}
|
||||||
|
|
||||||
m_scene.AddNewClient(this, true);
|
m_scene.AddNewClient(this, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -462,6 +555,9 @@ namespace OpenSim.Region.ClientStack
|
||||||
{
|
{
|
||||||
m_secureSessionId = sessionInfo.LoginInfo.SecureSession;
|
m_secureSessionId = sessionInfo.LoginInfo.SecureSession;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_clientVersion = sessionInfo.LoginInfo.ClientVersion; //rex
|
||||||
|
|
||||||
// This sets up all the timers
|
// This sets up all the timers
|
||||||
InitNewClient();
|
InitNewClient();
|
||||||
|
|
||||||
|
@ -540,6 +636,7 @@ namespace OpenSim.Region.ClientStack
|
||||||
public event UpdateInventoryItem OnUpdateInventoryItem;
|
public event UpdateInventoryItem OnUpdateInventoryItem;
|
||||||
public event CopyInventoryItem OnCopyInventoryItem;
|
public event CopyInventoryItem OnCopyInventoryItem;
|
||||||
public event MoveInventoryItem OnMoveInventoryItem;
|
public event MoveInventoryItem OnMoveInventoryItem;
|
||||||
|
public event RemoveInventoryItem OnRemoveInventoryItem; // rex
|
||||||
public event UDPAssetUploadRequest OnAssetUploadRequest;
|
public event UDPAssetUploadRequest OnAssetUploadRequest;
|
||||||
public event XferReceive OnXferReceive;
|
public event XferReceive OnXferReceive;
|
||||||
public event RequestXfer OnRequestXfer;
|
public event RequestXfer OnRequestXfer;
|
||||||
|
@ -548,6 +645,11 @@ namespace OpenSim.Region.ClientStack
|
||||||
public event UpdateTaskInventory OnUpdateTaskInventory;
|
public event UpdateTaskInventory OnUpdateTaskInventory;
|
||||||
public event RemoveTaskInventory OnRemoveTaskItem;
|
public event RemoveTaskInventory OnRemoveTaskItem;
|
||||||
|
|
||||||
|
//REX: Attachments
|
||||||
|
public event RezSingleAttachmentFromInv OnRezSingleAttachmentFromInv;
|
||||||
|
public event ObjectAttach OnObjectAttach;
|
||||||
|
public event ObjectDetach OnObjectDetach;
|
||||||
|
|
||||||
public event UUIDNameRequest OnNameFromUUIDRequest;
|
public event UUIDNameRequest OnNameFromUUIDRequest;
|
||||||
|
|
||||||
public event ParcelAccessListRequest OnParcelAccessListRequest;
|
public event ParcelAccessListRequest OnParcelAccessListRequest;
|
||||||
|
@ -566,6 +668,11 @@ namespace OpenSim.Region.ClientStack
|
||||||
public event FriendActionDelegate OnDenyFriendRequest;
|
public event FriendActionDelegate OnDenyFriendRequest;
|
||||||
public event FriendshipTermination OnTerminateFriendship;
|
public event FriendshipTermination OnTerminateFriendship;
|
||||||
|
|
||||||
|
public event ReceiveRexClientScriptCmd OnReceiveRexClientScriptCmd; // rex
|
||||||
|
public event ObjectClickAction OnObjectClickAction; // rex
|
||||||
|
public event UpdateAssetMediaURL OnUpdateAssetMediaURL; // rex
|
||||||
|
public event TriggerSound OnTriggerSound;
|
||||||
|
|
||||||
#region Scene/Avatar to Client
|
#region Scene/Avatar to Client
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -981,6 +1088,13 @@ namespace OpenSim.Region.ClientStack
|
||||||
i = 0;
|
i = 0;
|
||||||
foreach (InventoryItemBase item in items)
|
foreach (InventoryItemBase item in items)
|
||||||
{
|
{
|
||||||
|
//REX: Send also media url for the item if it has a one
|
||||||
|
if (!m_sentMediaUrls.ContainsKey(item.assetID))
|
||||||
|
{
|
||||||
|
//Start a request for material
|
||||||
|
m_assetCache.GetAsset(item.assetID, MediaURLAssetRequest);
|
||||||
|
}
|
||||||
|
|
||||||
descend.ItemData[i] = new InventoryDescendentsPacket.ItemDataBlock();
|
descend.ItemData[i] = new InventoryDescendentsPacket.ItemDataBlock();
|
||||||
descend.ItemData[i].ItemID = item.inventoryID;
|
descend.ItemData[i].ItemID = item.inventoryID;
|
||||||
descend.ItemData[i].AssetID = item.assetID;
|
descend.ItemData[i].AssetID = item.assetID;
|
||||||
|
@ -1276,6 +1390,25 @@ namespace OpenSim.Region.ClientStack
|
||||||
OutPacket(loadURL, ThrottleOutPacketType.Task);
|
OutPacket(loadURL, ThrottleOutPacketType.Task);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SendDialog(string objectname, LLUUID objectID, LLUUID ownerID, string msg, LLUUID textureID, int ch, string[] buttonlabels)
|
||||||
|
{
|
||||||
|
ScriptDialogPacket dialog = (ScriptDialogPacket)PacketPool.Instance.GetPacket(PacketType.ScriptDialog);
|
||||||
|
dialog.Data.ObjectID = objectID;
|
||||||
|
dialog.Data.ObjectName = Helpers.StringToField(objectname);
|
||||||
|
dialog.Data.FirstName = Helpers.StringToField(this.FirstName);
|
||||||
|
dialog.Data.LastName = Helpers.StringToField(this.LastName);
|
||||||
|
dialog.Data.Message = Helpers.StringToField(msg);
|
||||||
|
dialog.Data.ImageID = textureID;
|
||||||
|
dialog.Data.ChatChannel = ch;
|
||||||
|
ScriptDialogPacket.ButtonsBlock[] buttons = new ScriptDialogPacket.ButtonsBlock[buttonlabels.Length];
|
||||||
|
for (int i = 0; i < buttonlabels.Length; i++)
|
||||||
|
{
|
||||||
|
buttons[i] = new ScriptDialogPacket.ButtonsBlock();
|
||||||
|
buttons[i].ButtonLabel = Helpers.StringToField(buttonlabels[i]);
|
||||||
|
}
|
||||||
|
dialog.Buttons = buttons;
|
||||||
|
OutPacket(dialog, ThrottleOutPacketType.Task);
|
||||||
|
}
|
||||||
|
|
||||||
public void SendPreLoadSound(LLUUID objectID, LLUUID ownerID, LLUUID soundID)
|
public void SendPreLoadSound(LLUUID objectID, LLUUID ownerID, LLUUID soundID)
|
||||||
{
|
{
|
||||||
|
@ -1301,6 +1434,20 @@ namespace OpenSim.Region.ClientStack
|
||||||
OutPacket(sound, ThrottleOutPacketType.Task);
|
OutPacket(sound, ThrottleOutPacketType.Task);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SendTriggeredSound(LLUUID soundID, LLUUID ownerID, LLUUID objectID, LLUUID parentID, ulong handle, LLVector3 position, float gain)
|
||||||
|
{
|
||||||
|
SoundTriggerPacket sound = (SoundTriggerPacket)PacketPool.Instance.GetPacket(PacketType.SoundTrigger);
|
||||||
|
sound.SoundData.SoundID = soundID;
|
||||||
|
sound.SoundData.OwnerID = ownerID;
|
||||||
|
sound.SoundData.ObjectID = objectID;
|
||||||
|
sound.SoundData.ParentID = parentID;
|
||||||
|
sound.SoundData.Handle = handle;
|
||||||
|
sound.SoundData.Position = position;
|
||||||
|
sound.SoundData.Gain = gain;
|
||||||
|
|
||||||
|
OutPacket(sound, ThrottleOutPacketType.Task);
|
||||||
|
}
|
||||||
|
|
||||||
public void SendSunPos(LLVector3 sunPos, LLVector3 sunVel)
|
public void SendSunPos(LLVector3 sunPos, LLVector3 sunVel)
|
||||||
{
|
{
|
||||||
SimulatorViewerTimeMessagePacket viewertime = (SimulatorViewerTimeMessagePacket)PacketPool.Instance.GetPacket(PacketType.SimulatorViewerTimeMessage);
|
SimulatorViewerTimeMessagePacket viewertime = (SimulatorViewerTimeMessagePacket)PacketPool.Instance.GetPacket(PacketType.SimulatorViewerTimeMessage);
|
||||||
|
@ -1377,6 +1524,17 @@ namespace OpenSim.Region.ClientStack
|
||||||
OutPacket(avatarReply, ThrottleOutPacketType.Task);
|
OutPacket(avatarReply, ThrottleOutPacketType.Task);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//rex
|
||||||
|
public void SendScriptTeleportRequest(string objectName, string simName, LLVector3 simPosition, LLVector3 lookAt)
|
||||||
|
{
|
||||||
|
ScriptTeleportRequestPacket teleportRequest = (ScriptTeleportRequestPacket)PacketPool.Instance.GetPacket(PacketType.ScriptTeleportRequest);
|
||||||
|
teleportRequest.Data.ObjectName = Helpers.StringToField(objectName);
|
||||||
|
teleportRequest.Data.SimName = Helpers.StringToField(simName);
|
||||||
|
teleportRequest.Data.SimPosition = simPosition;
|
||||||
|
teleportRequest.Data.LookAt = lookAt;
|
||||||
|
OutPacket(teleportRequest, ThrottleOutPacketType.Task);
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Appearance/ Wearables Methods
|
#region Appearance/ Wearables Methods
|
||||||
|
@ -1433,6 +1591,23 @@ namespace OpenSim.Region.ClientStack
|
||||||
OutPacket(avp, ThrottleOutPacketType.Task);
|
OutPacket(avp, ThrottleOutPacketType.Task);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Used in rex mode instead of SendAppearance for sending appearance storage address
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="agentID"></param>
|
||||||
|
/// <param name="avatarAdrress"></param>
|
||||||
|
public void SendRexAppearance(LLUUID agentID, string avatarAddress) //rex
|
||||||
|
{
|
||||||
|
GenericMessagePacket gmp = new GenericMessagePacket();
|
||||||
|
gmp.MethodData.Method = Helpers.StringToField("RexAppearance");
|
||||||
|
gmp.ParamList = new GenericMessagePacket.ParamListBlock[2];
|
||||||
|
gmp.ParamList[0] = new GenericMessagePacket.ParamListBlock();
|
||||||
|
gmp.ParamList[0].Parameter = Helpers.StringToField(avatarAddress);
|
||||||
|
gmp.ParamList[1] = new GenericMessagePacket.ParamListBlock();
|
||||||
|
gmp.ParamList[1].Parameter = Helpers.StringToField(agentID.ToString());
|
||||||
|
OutPacket(gmp, ThrottleOutPacketType.Task);
|
||||||
|
}
|
||||||
|
|
||||||
public void SendAnimations(LLUUID[] animations, int[] seqs, LLUUID sourceAgentId)
|
public void SendAnimations(LLUUID[] animations, int[] seqs, LLUUID sourceAgentId)
|
||||||
{
|
{
|
||||||
AvatarAnimationPacket ani = (AvatarAnimationPacket)PacketPool.Instance.GetPacket(PacketType.AvatarAnimation);
|
AvatarAnimationPacket ani = (AvatarAnimationPacket)PacketPool.Instance.GetPacket(PacketType.AvatarAnimation);
|
||||||
|
@ -1596,9 +1771,69 @@ namespace OpenSim.Region.ClientStack
|
||||||
byte[] rot = rotation.GetBytes();
|
byte[] rot = rotation.GetBytes();
|
||||||
Array.Copy(rot, 0, outPacket.ObjectData[0].ObjectData, 36, rot.Length);
|
Array.Copy(rot, 0, outPacket.ObjectData[0].ObjectData, 36, rot.Length);
|
||||||
|
|
||||||
|
//REX: Check if the material has media url and send it if necessary
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (m_rexClient && primShape.TextureEntry != null)
|
||||||
|
{
|
||||||
|
LLObject.TextureEntry tex = new LLObject.TextureEntry(primShape.TextureEntry, 0, primShape.TextureEntry.Length);
|
||||||
|
foreach (LLObject.TextureEntryFace face in tex.FaceTextures)
|
||||||
|
{
|
||||||
|
if (face != null && face.TextureID != null)
|
||||||
|
{
|
||||||
|
if (!m_sentMediaUrls.ContainsKey(face.TextureID))
|
||||||
|
{
|
||||||
|
//Start a request for material
|
||||||
|
m_assetCache.GetAsset(face.TextureID, MediaURLAssetRequest);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (IndexOutOfRangeException)
|
||||||
|
{
|
||||||
|
// If primShape.TextureEntry length is 44, throws exception. Bug in libsl or Opensim?
|
||||||
|
MainLog.Instance.Warn("CLIENT", "Error processing " + objectID + " texture data");
|
||||||
|
}
|
||||||
|
|
||||||
OutPacket(outPacket, ThrottleOutPacketType.Task);
|
OutPacket(outPacket, ThrottleOutPacketType.Task);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//REX
|
||||||
|
public void MediaURLAssetRequest(LLUUID assetID, AssetBase asset)
|
||||||
|
{
|
||||||
|
if (asset != null)
|
||||||
|
{
|
||||||
|
if (asset.MediaURL != String.Empty)
|
||||||
|
{
|
||||||
|
SendMediaURL(assetID, asset.MediaURL);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//Media url not set, just set empty string to avoid further queries
|
||||||
|
m_sentMediaUrls[assetID] = string.Empty;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MainLog.Instance.Warn("CLIENT", "Could not get asset: " + assetID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//REX
|
||||||
|
public void SendMediaURL(LLUUID assetID, string mediaURL)
|
||||||
|
{
|
||||||
|
if (m_rexClient && (!m_sentMediaUrls.ContainsKey(assetID) || m_sentMediaUrls[assetID] != mediaURL))
|
||||||
|
{
|
||||||
|
RexImageInfoPacket rexImgInfoPacket = new RexImageInfoPacket();
|
||||||
|
rexImgInfoPacket.Header.Reliable = true;
|
||||||
|
rexImgInfoPacket.ImageInfo.MediaURL = Helpers.StringToField(mediaURL);
|
||||||
|
rexImgInfoPacket.ImageInfo.ImageID = assetID;
|
||||||
|
OutPacket(rexImgInfoPacket, ThrottleOutPacketType.Task);
|
||||||
|
m_sentMediaUrls[assetID] = mediaURL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -1635,6 +1870,30 @@ namespace OpenSim.Region.ClientStack
|
||||||
OutPacket(terse, ThrottleOutPacketType.Task);
|
OutPacket(terse, ThrottleOutPacketType.Task);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Rex, send script command to client
|
||||||
|
public void SendRexScriptCommand(string vUnit, string vCommand, string vCmdParams) //rex
|
||||||
|
{
|
||||||
|
GenericMessagePacket gmp = new GenericMessagePacket();
|
||||||
|
gmp.MethodData.Method = Helpers.StringToField("RexScr");
|
||||||
|
|
||||||
|
if (vCmdParams.Length > 0)
|
||||||
|
gmp.ParamList = new GenericMessagePacket.ParamListBlock[3];
|
||||||
|
else
|
||||||
|
gmp.ParamList = new GenericMessagePacket.ParamListBlock[2];
|
||||||
|
|
||||||
|
gmp.ParamList[0] = new GenericMessagePacket.ParamListBlock();
|
||||||
|
gmp.ParamList[0].Parameter = Helpers.StringToField(vUnit);
|
||||||
|
gmp.ParamList[1] = new GenericMessagePacket.ParamListBlock();
|
||||||
|
gmp.ParamList[1].Parameter = Helpers.StringToField(vCommand);
|
||||||
|
if (vCmdParams.Length > 0)
|
||||||
|
{
|
||||||
|
gmp.ParamList[2] = new GenericMessagePacket.ParamListBlock();
|
||||||
|
gmp.ParamList[2].Parameter = Helpers.StringToField(vCmdParams);
|
||||||
|
}
|
||||||
|
OutPacket(gmp, ThrottleOutPacketType.Task);
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Helper Methods
|
#region Helper Methods
|
||||||
|
@ -2312,10 +2571,16 @@ namespace OpenSim.Region.ClientStack
|
||||||
{
|
{
|
||||||
int packetsize = Helpers.ZeroEncode(sendbuffer, sendbuffer.Length, ZeroOutBuffer);
|
int packetsize = Helpers.ZeroEncode(sendbuffer, sendbuffer.Length, ZeroOutBuffer);
|
||||||
m_networkServer.SendPacketTo(ZeroOutBuffer, packetsize, SocketFlags.None, m_circuitCode);
|
m_networkServer.SendPacketTo(ZeroOutBuffer, packetsize, SocketFlags.None, m_circuitCode);
|
||||||
|
OpenSim.Framework.ServerStatus.ServerStatus.ReportOutPacketUdp(packetsize, Pack.Header.Resent);//rex
|
||||||
|
OpenSim.Framework.ServerStatus.ServerStatus.
|
||||||
|
ReportProcessedOutPacket(Pack.GetType().ToString(), packetsize, Pack.Header.Resent); //rex
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_networkServer.SendPacketTo(sendbuffer, sendbuffer.Length, SocketFlags.None, m_circuitCode);
|
m_networkServer.SendPacketTo(sendbuffer, sendbuffer.Length, SocketFlags.None, m_circuitCode);
|
||||||
|
OpenSim.Framework.ServerStatus.ServerStatus.ReportOutPacketUdp(sendbuffer.Length, Pack.Header.Resent);//rex
|
||||||
|
OpenSim.Framework.ServerStatus.ServerStatus.
|
||||||
|
ReportProcessedOutPacket(Pack.GetType().ToString(), sendbuffer.Length, Pack.Header.Resent);//rex
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
@ -2326,6 +2591,12 @@ namespace OpenSim.Region.ClientStack
|
||||||
MainLog.Instance.Error(e.ToString());
|
MainLog.Instance.Error(e.ToString());
|
||||||
Close(true);
|
Close(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Pack.Header.Resent)
|
||||||
|
{
|
||||||
|
//Allow for later resending
|
||||||
|
Pack.Header.Resent = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void InPacket(Packet NewPack)
|
public virtual void InPacket(Packet NewPack)
|
||||||
|
@ -2421,8 +2692,8 @@ namespace OpenSim.Region.ClientStack
|
||||||
{
|
{
|
||||||
if ((now - packet.TickCount > RESEND_TIMEOUT) && (!packet.Header.Resent))
|
if ((now - packet.TickCount > RESEND_TIMEOUT) && (!packet.Header.Resent))
|
||||||
{
|
{
|
||||||
MainLog.Instance.Verbose("NETWORK", "Resending " + packet.Type.ToString() + " packet, " +
|
/*MainLog.Instance.Verbose("NETWORK", "Resending " + packet.Type.ToString() + " packet, " +
|
||||||
(now - packet.TickCount) + "ms have passed");
|
(now - packet.TickCount) + "ms have passed");*/
|
||||||
|
|
||||||
packet.Header.Resent = true;
|
packet.Header.Resent = true;
|
||||||
OutPacket(packet, ThrottleOutPacketType.Resend);
|
OutPacket(packet, ThrottleOutPacketType.Resend);
|
||||||
|
@ -2492,6 +2763,8 @@ namespace OpenSim.Region.ClientStack
|
||||||
|
|
||||||
protected void ProcessInPacket(Packet Pack)
|
protected void ProcessInPacket(Packet Pack)
|
||||||
{
|
{
|
||||||
|
OpenSim.Framework.ServerStatus.ServerStatus.ReportProcessedInPacket(Pack.GetType().ToString(), Pack.ToBytes().Length);
|
||||||
|
|
||||||
ack_pack(Pack);
|
ack_pack(Pack);
|
||||||
|
|
||||||
if (ProcessPacketMethod(Pack))
|
if (ProcessPacketMethod(Pack))
|
||||||
|
@ -2740,6 +3013,20 @@ namespace OpenSim.Region.ClientStack
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
// rex, added handling of genericmessage for rexscr method
|
||||||
|
case PacketType.GenericMessage:
|
||||||
|
GenericMessagePacket gmpacket = (GenericMessagePacket)Pack;
|
||||||
|
string sMethod = Helpers.FieldToUTF8String(gmpacket.MethodData.Method);
|
||||||
|
|
||||||
|
if (sMethod == "rexscr" && OnReceiveRexClientScriptCmd != null)
|
||||||
|
{
|
||||||
|
List<string> tmplist = new List<string>();
|
||||||
|
for (int i=0;i<gmpacket.ParamList.Length;i++)
|
||||||
|
tmplist.Add(Helpers.FieldToUTF8String(gmpacket.ParamList[i].Parameter));
|
||||||
|
|
||||||
|
OnReceiveRexClientScriptCmd(this, gmpacket.AgentData.AgentID, tmplist);
|
||||||
|
}
|
||||||
|
break;
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Objects/m_sceneObjects
|
#region Objects/m_sceneObjects
|
||||||
|
@ -3163,6 +3450,16 @@ namespace OpenSim.Region.ClientStack
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case PacketType.RemoveInventoryItem: // rex
|
||||||
|
RemoveInventoryItemPacket removeItem = (RemoveInventoryItemPacket)Pack;
|
||||||
|
if (OnRemoveInventoryItem != null)
|
||||||
|
{
|
||||||
|
foreach (RemoveInventoryItemPacket.InventoryDataBlock datablock in removeItem.InventoryData)
|
||||||
|
{
|
||||||
|
OnRemoveInventoryItem(this, datablock.ItemID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
case PacketType.RequestTaskInventory:
|
case PacketType.RequestTaskInventory:
|
||||||
RequestTaskInventoryPacket requesttask = (RequestTaskInventoryPacket)Pack;
|
RequestTaskInventoryPacket requesttask = (RequestTaskInventoryPacket)Pack;
|
||||||
if (OnRequestTaskInventory != null)
|
if (OnRequestTaskInventory != null)
|
||||||
|
@ -3482,10 +3779,12 @@ namespace OpenSim.Region.ClientStack
|
||||||
// TODO: handle this packet
|
// TODO: handle this packet
|
||||||
MainLog.Instance.Warn("CLIENT", "unhandled CreateGroupRequest packet");
|
MainLog.Instance.Warn("CLIENT", "unhandled CreateGroupRequest packet");
|
||||||
break;
|
break;
|
||||||
|
/* rex, removed
|
||||||
case PacketType.GenericMessage:
|
case PacketType.GenericMessage:
|
||||||
// TODO: handle this packet
|
// TODO: handle this packet
|
||||||
MainLog.Instance.Warn("CLIENT", "unhandled GenericMessage packet");
|
MainLog.Instance.Warn("CLIENT", "unhandled GenericMessage packet");
|
||||||
break;
|
break;
|
||||||
|
*/
|
||||||
case PacketType.MapItemRequest:
|
case PacketType.MapItemRequest:
|
||||||
// TODO: handle this packet
|
// TODO: handle this packet
|
||||||
MainLog.Instance.Warn("CLIENT", "unhandled MapItemRequest packet");
|
MainLog.Instance.Warn("CLIENT", "unhandled MapItemRequest packet");
|
||||||
|
@ -3532,9 +3831,11 @@ namespace OpenSim.Region.ClientStack
|
||||||
MainLog.Instance.Warn("CLIENT", "unhandled ObjectSpinStop packet");
|
MainLog.Instance.Warn("CLIENT", "unhandled ObjectSpinStop packet");
|
||||||
break;
|
break;
|
||||||
case PacketType.SoundTrigger:
|
case PacketType.SoundTrigger:
|
||||||
// TODO: handle this packet
|
{
|
||||||
MainLog.Instance.Warn("CLIENT", "unhandled SoundTrigger packet");
|
SoundTriggerPacket packet = (SoundTriggerPacket)Pack;
|
||||||
|
OnTriggerSound(this, packet.SoundData.SoundID, packet.SoundData.OwnerID, packet.SoundData.ObjectID, packet.SoundData.ParentID, packet.SoundData.Handle, packet.SoundData.Position, packet.SoundData.Gain);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case PacketType.UserInfoRequest:
|
case PacketType.UserInfoRequest:
|
||||||
// TODO: handle this packet
|
// TODO: handle this packet
|
||||||
MainLog.Instance.Warn("CLIENT", "unhandled UserInfoRequest packet");
|
MainLog.Instance.Warn("CLIENT", "unhandled UserInfoRequest packet");
|
||||||
|
@ -3543,6 +3844,61 @@ namespace OpenSim.Region.ClientStack
|
||||||
// TODO: handle this packet
|
// TODO: handle this packet
|
||||||
MainLog.Instance.Warn("CLIENT", "unhandled InventoryDescent packet");
|
MainLog.Instance.Warn("CLIENT", "unhandled InventoryDescent packet");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
//Attachments
|
||||||
|
case PacketType.RezSingleAttachmentFromInv:
|
||||||
|
{
|
||||||
|
RezSingleAttachmentFromInvPacket packet = (RezSingleAttachmentFromInvPacket)Pack;
|
||||||
|
|
||||||
|
OnRezSingleAttachmentFromInv(this, packet.ObjectData.ItemID, packet.ObjectData.OwnerID,
|
||||||
|
packet.ObjectData.ItemFlags, packet.ObjectData.AttachmentPt);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case PacketType.ObjectDetach:
|
||||||
|
{
|
||||||
|
ObjectDetachPacket packet = (ObjectDetachPacket)Pack;
|
||||||
|
|
||||||
|
foreach (ObjectDetachPacket.ObjectDataBlock block in packet.ObjectData)
|
||||||
|
{
|
||||||
|
OnObjectDetach(this, block.ObjectLocalID);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case PacketType.ObjectAttach:
|
||||||
|
{
|
||||||
|
ObjectAttachPacket packet = (ObjectAttachPacket)Pack;
|
||||||
|
|
||||||
|
foreach(ObjectAttachPacket.ObjectDataBlock block in packet.ObjectData)
|
||||||
|
{
|
||||||
|
OnObjectAttach(this, block.ObjectLocalID, block.Rotation, packet.AgentData.AttachmentPoint);
|
||||||
|
}
|
||||||
|
//OutPacket(packet, ThrottleOutPacketType.Task);
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
//REX: RexImageInfo packet used for handling mediaurl information
|
||||||
|
case PacketType.RexImageInfo:
|
||||||
|
// TODO: handle this packet
|
||||||
|
RexImageInfoPacket imageInfo = (RexImageInfoPacket)Pack;
|
||||||
|
|
||||||
|
MainLog.Instance.Verbose("CLIENTVIEW", "Got mediaUrl: " + Helpers.FieldToUTF8String(imageInfo.ImageInfo.MediaURL));
|
||||||
|
|
||||||
|
OnUpdateAssetMediaURL(this, imageInfo.ImageInfo.ImageID,
|
||||||
|
Helpers.FieldToUTF8String(imageInfo.ImageInfo.MediaURL));
|
||||||
|
break;
|
||||||
|
|
||||||
|
//REX ObjectClickAction implementation
|
||||||
|
case PacketType.ObjectClickAction:
|
||||||
|
ObjectClickActionPacket clickActionPacket = (ObjectClickActionPacket)Pack;
|
||||||
|
foreach (ObjectClickActionPacket.ObjectDataBlock block in clickActionPacket.ObjectData)
|
||||||
|
{
|
||||||
|
OnObjectClickAction(this, block.ObjectLocalID, block.ClickAction);
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
MainLog.Instance.Warn("CLIENT", "unhandled packet " + Pack.ToString());
|
MainLog.Instance.Warn("CLIENT", "unhandled packet " + Pack.ToString());
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -0,0 +1,41 @@
|
||||||
|
using libsecondlife.Packets;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using OpenSim.Framework;
|
||||||
|
|
||||||
|
|
||||||
|
namespace OpenSim.Region.ClientStack
|
||||||
|
{
|
||||||
|
public class PacketPrioritizer
|
||||||
|
{
|
||||||
|
private Dictionary<PacketType, int> Priorities;
|
||||||
|
|
||||||
|
public PacketPrioritizer()
|
||||||
|
{
|
||||||
|
Priorities = new Dictionary<PacketType, int>();
|
||||||
|
|
||||||
|
//High priority packets
|
||||||
|
/*Priorities[PacketType.StartPingCheck] = 60000;
|
||||||
|
Priorities[PacketType.PacketAck] = 60000;*/
|
||||||
|
|
||||||
|
//Very low priority packets
|
||||||
|
Priorities[PacketType.ObjectImage] = 1;
|
||||||
|
Priorities[PacketType.ImageData] = 1;
|
||||||
|
Priorities[PacketType.ImagePacket] = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Bind(PrioritizedQueue<QueItem> queue)
|
||||||
|
{
|
||||||
|
queue.PriorityDeterminer = new PrioritizedQueue<QueItem>.DeterminePriorityDelegate(this.DeterminePriority);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int DeterminePriority(QueItem item)
|
||||||
|
{
|
||||||
|
Packet packet = item.Packet;
|
||||||
|
if (Priorities.ContainsKey(packet.Type))
|
||||||
|
return Priorities[packet.Type];
|
||||||
|
|
||||||
|
//Default priority is 20
|
||||||
|
return 50;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -37,6 +37,7 @@ using OpenSim.Framework.Servers;
|
||||||
using OpenSim.Region.Environment;
|
using OpenSim.Region.Environment;
|
||||||
using OpenSim.Region.Environment.Scenes;
|
using OpenSim.Region.Environment.Scenes;
|
||||||
using OpenSim.Region.Physics.Manager;
|
using OpenSim.Region.Physics.Manager;
|
||||||
|
using OpenSim.Region.Communications.VoiceChat;
|
||||||
|
|
||||||
namespace OpenSim.Region.ClientStack
|
namespace OpenSim.Region.ClientStack
|
||||||
{
|
{
|
||||||
|
@ -58,6 +59,8 @@ namespace OpenSim.Region.ClientStack
|
||||||
protected StorageManager m_storageManager;
|
protected StorageManager m_storageManager;
|
||||||
protected string m_storageConnectionString;
|
protected string m_storageConnectionString;
|
||||||
|
|
||||||
|
protected VoiceChatServer m_voiceChatServer;
|
||||||
|
|
||||||
public SceneManager SceneManager
|
public SceneManager SceneManager
|
||||||
{
|
{
|
||||||
get { return m_sceneManager; }
|
get { return m_sceneManager; }
|
||||||
|
@ -108,6 +111,7 @@ namespace OpenSim.Region.ClientStack
|
||||||
udpServer = new UDPServer((uint) regionInfo.InternalEndPoint.Port, m_assetCache, m_log, circuitManager);
|
udpServer = new UDPServer((uint) regionInfo.InternalEndPoint.Port, m_assetCache, m_log, circuitManager);
|
||||||
|
|
||||||
Scene scene = CreateScene(regionInfo, m_storageManager, circuitManager);
|
Scene scene = CreateScene(regionInfo, m_storageManager, circuitManager);
|
||||||
|
m_voiceChatServer = new VoiceChatServer(scene);
|
||||||
|
|
||||||
udpServer.LocalScene = scene;
|
udpServer.LocalScene = scene;
|
||||||
|
|
||||||
|
@ -129,6 +133,7 @@ namespace OpenSim.Region.ClientStack
|
||||||
m_commsManager.UserService.SetupMasterUser(scene.RegionInfo.MasterAvatarFirstName,
|
m_commsManager.UserService.SetupMasterUser(scene.RegionInfo.MasterAvatarFirstName,
|
||||||
scene.RegionInfo.MasterAvatarLastName,
|
scene.RegionInfo.MasterAvatarLastName,
|
||||||
scene.RegionInfo.MasterAvatarSandboxPassword);
|
scene.RegionInfo.MasterAvatarSandboxPassword);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (masterAvatar != null)
|
if (masterAvatar != null)
|
||||||
|
|
|
@ -0,0 +1,206 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Timers;
|
||||||
|
using Timer = System.Timers.Timer;
|
||||||
|
|
||||||
|
using OpenSim.Framework;
|
||||||
|
using libsecondlife.Packets;
|
||||||
|
|
||||||
|
namespace OpenSim.Region.ClientStack
|
||||||
|
{
|
||||||
|
public class RexPacketQueue
|
||||||
|
{
|
||||||
|
//Object for syncing enqueue / dequeue
|
||||||
|
private object m_queueSync = new object();
|
||||||
|
|
||||||
|
LinkedList<QueItem> m_incoming; //Non throttled packets (highpr. and incoming)
|
||||||
|
LinkedList<QueItem> m_nonThrottled; //Non throttled packets (highpr. and incoming)
|
||||||
|
PrioritizedQueue<QueItem> m_queue; //Normally prioritized to be sent packets
|
||||||
|
|
||||||
|
PacketPrioritizer m_prioritizer;
|
||||||
|
Timer m_throttleUpdater;
|
||||||
|
|
||||||
|
const int m_throttleAdjustInterval = 1000; //Adjust throttle every 5 seconds
|
||||||
|
int m_throttleAdjustTimeLeft = m_throttleAdjustInterval;
|
||||||
|
|
||||||
|
const int m_throttleRefreshRate = 200; //200ms
|
||||||
|
int m_throttleOutboundMin = (5000 * m_throttleRefreshRate)/1000; //5KB/sec
|
||||||
|
int m_throttleOutboundMax = (200000 * m_throttleRefreshRate)/1000; //200KB/sec
|
||||||
|
|
||||||
|
|
||||||
|
//200KB/sec (attempt to start at full speed)
|
||||||
|
int m_throttleOutbound = (200000 * m_throttleRefreshRate)/1000;
|
||||||
|
|
||||||
|
int m_sentBytes = 0; //Amount of bytes sent currently
|
||||||
|
|
||||||
|
|
||||||
|
int m_resentBytes = 0; //Amount of resent bytes
|
||||||
|
int m_resendQueued = 0; //Amount of queued resend packets
|
||||||
|
|
||||||
|
public RexPacketQueue(int startTraffic, int maxTraffic, int minTraffic)
|
||||||
|
{
|
||||||
|
m_throttleOutboundMin = (minTraffic * m_throttleRefreshRate) / 1000; //5KB/sec
|
||||||
|
m_throttleOutboundMax = (maxTraffic * m_throttleRefreshRate) / 1000; //200KB/sec
|
||||||
|
|
||||||
|
//200KB/sec (attempt to start at full speed)
|
||||||
|
m_throttleOutbound = (startTraffic * m_throttleRefreshRate) / 1000;
|
||||||
|
|
||||||
|
m_queue = new PrioritizedQueue<QueItem>();
|
||||||
|
m_incoming = new LinkedList<QueItem>();
|
||||||
|
m_nonThrottled = new LinkedList<QueItem>();
|
||||||
|
m_prioritizer = new PacketPrioritizer();
|
||||||
|
m_prioritizer.Bind(m_queue);
|
||||||
|
|
||||||
|
m_throttleUpdater = new Timer(m_throttleRefreshRate);
|
||||||
|
m_throttleUpdater.Elapsed += new ElapsedEventHandler(ThrottleRefresh);
|
||||||
|
m_throttleUpdater.Start();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Enqueue(QueItem item)
|
||||||
|
{
|
||||||
|
lock (m_queueSync)
|
||||||
|
{
|
||||||
|
if (item.throttleType == ThrottleOutPacketType.Resend)
|
||||||
|
m_resendQueued++;
|
||||||
|
|
||||||
|
if (item.Incoming)
|
||||||
|
{
|
||||||
|
m_incoming.AddLast(item);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (item.Packet.Type == PacketType.ImprovedTerseObjectUpdate ||
|
||||||
|
item.Packet.Type == PacketType.CoarseLocationUpdate ||
|
||||||
|
item.Packet.Type == PacketType.AvatarAnimation ||
|
||||||
|
item.Packet.Type == PacketType.StartPingCheck ||
|
||||||
|
item.Packet.Type == PacketType.CompletePingCheck ||
|
||||||
|
item.Packet.Type == PacketType.PacketAck)
|
||||||
|
{
|
||||||
|
m_nonThrottled.AddLast(item);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_queue.Enqueue(item);
|
||||||
|
}
|
||||||
|
if (item.Packet.Header.Resent)
|
||||||
|
{
|
||||||
|
m_resentBytes += item.Packet.ToBytes().Length;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Monitor.Pulse(m_queueSync);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public QueItem Dequeue()
|
||||||
|
{
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
|
lock (m_queueSync)
|
||||||
|
{
|
||||||
|
QueItem item = null;
|
||||||
|
|
||||||
|
//Immediately process incoming packets
|
||||||
|
if (m_incoming.First != null)
|
||||||
|
{
|
||||||
|
item = m_incoming.First.Value;
|
||||||
|
m_incoming.RemoveFirst();
|
||||||
|
}
|
||||||
|
//Then try to pick a super-high-priority packet first
|
||||||
|
else if (m_nonThrottled.First != null)
|
||||||
|
{
|
||||||
|
item = m_nonThrottled.First.Value;
|
||||||
|
m_nonThrottled.RemoveFirst();
|
||||||
|
}
|
||||||
|
//Then check for other packets
|
||||||
|
else if (m_sentBytes < m_throttleOutbound && m_queue.HasQueuedItems())
|
||||||
|
{
|
||||||
|
item = m_queue.Dequeue();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (item != null)
|
||||||
|
{
|
||||||
|
if (!item.Incoming)
|
||||||
|
{
|
||||||
|
m_sentBytes += item.Packet.ToBytes().Length;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (item.throttleType == ThrottleOutPacketType.Resend)
|
||||||
|
m_resendQueued--;
|
||||||
|
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
|
||||||
|
Monitor.Wait(m_queueSync);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Close()
|
||||||
|
{
|
||||||
|
m_throttleUpdater.Stop();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Flush()
|
||||||
|
{
|
||||||
|
//not implemented
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetThrottleFromClient(byte[] data)
|
||||||
|
{
|
||||||
|
//not implemented
|
||||||
|
}
|
||||||
|
|
||||||
|
void ThrottleRefresh(object sender, ElapsedEventArgs e)
|
||||||
|
{
|
||||||
|
//Handle throttle adjusting
|
||||||
|
m_throttleAdjustTimeLeft -= m_throttleRefreshRate;
|
||||||
|
if (m_throttleAdjustTimeLeft <= 0)
|
||||||
|
{
|
||||||
|
AdjustThrottle();
|
||||||
|
m_resentBytes = 0;
|
||||||
|
m_throttleAdjustTimeLeft += m_throttleAdjustInterval;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Lock to cause wait abort as we can send now more data
|
||||||
|
lock (m_queueSync)
|
||||||
|
{
|
||||||
|
m_sentBytes = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void AdjustThrottle()
|
||||||
|
{
|
||||||
|
if (m_resentBytes == 0)
|
||||||
|
{
|
||||||
|
//Increase out traffic by 5% if we're trying to send data more than current max
|
||||||
|
if (m_sentBytes >= m_throttleOutbound)
|
||||||
|
{
|
||||||
|
m_throttleOutbound = (m_throttleOutbound * 105) / 100;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//Determine proper traffic level
|
||||||
|
int resentPerPeriod = (m_resentBytes * m_throttleRefreshRate) / m_throttleAdjustInterval;
|
||||||
|
m_throttleOutbound -= resentPerPeriod;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Limit throttle
|
||||||
|
if (m_throttleOutbound > m_throttleOutboundMax)
|
||||||
|
{
|
||||||
|
m_throttleOutbound = m_throttleOutboundMax;
|
||||||
|
}
|
||||||
|
else if (m_throttleOutbound < m_throttleOutboundMin)
|
||||||
|
{
|
||||||
|
m_throttleOutbound = m_throttleOutboundMin;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool IsHighestPriority(PacketType type)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -107,6 +107,9 @@ namespace OpenSim.Region.ClientStack
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
numBytes = Server.EndReceiveFrom(result, ref epSender);
|
numBytes = Server.EndReceiveFrom(result, ref epSender);
|
||||||
|
|
||||||
|
//Report byte count to rex statuswindow
|
||||||
|
OpenSim.Framework.ServerStatus.ServerStatus.ReportInPacketUdp(numBytes);
|
||||||
}
|
}
|
||||||
catch (SocketException e)
|
catch (SocketException e)
|
||||||
{
|
{
|
||||||
|
@ -272,7 +275,28 @@ namespace OpenSim.Region.ClientStack
|
||||||
if (clientCircuits_reverse.TryGetValue(circuitcode, out sendto))
|
if (clientCircuits_reverse.TryGetValue(circuitcode, out sendto))
|
||||||
{
|
{
|
||||||
//we found the endpoint so send the packet to it
|
//we found the endpoint so send the packet to it
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
Server.SendTo(buffer, size, flags, sendto);
|
Server.SendTo(buffer, size, flags, sendto);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
catch (SocketException e)
|
||||||
|
{
|
||||||
|
if (e.ErrorCode == 10055)
|
||||||
|
{
|
||||||
|
//Send buffer full, halt for half second and retry
|
||||||
|
MainLog.Instance.Warn("SERVER", "Socket send buffer was full, halting for 200ms");
|
||||||
|
System.Threading.Thread.Sleep(200);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//Rethrow
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -361,8 +361,13 @@ namespace OpenSim.Region.Communications.Local
|
||||||
agent.InventoryFolder = loginData.InventoryFolder;
|
agent.InventoryFolder = loginData.InventoryFolder;
|
||||||
agent.startpos = loginData.StartPos;
|
agent.startpos = loginData.StartPos;
|
||||||
|
|
||||||
|
agent.ClientVersion = loginData.ClientVersion; //rex
|
||||||
|
|
||||||
agent.CapsPath = loginData.CapsPath;
|
agent.CapsPath = loginData.CapsPath;
|
||||||
|
|
||||||
|
agent.authenticationAddr = loginData.AuthAddr;
|
||||||
|
agent.asAddress = loginData.asAddress;
|
||||||
|
|
||||||
TriggerExpectUser(regionHandle, agent);
|
TriggerExpectUser(regionHandle, agent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -53,8 +53,8 @@ namespace OpenSim.Region.Communications.Local
|
||||||
public event LoginToRegionEvent OnLoginToRegion;
|
public event LoginToRegionEvent OnLoginToRegion;
|
||||||
|
|
||||||
public LocalLoginService(UserManagerBase userManager, string welcomeMess, CommunicationsLocal parent,
|
public LocalLoginService(UserManagerBase userManager, string welcomeMess, CommunicationsLocal parent,
|
||||||
NetworkServersInfo serversInfo, bool authenticate)
|
NetworkServersInfo serversInfo, bool authenticate, bool rexMode)
|
||||||
: base(userManager, parent.UserProfileCacheService.libraryRoot, welcomeMess)
|
: base(userManager, parent.UserProfileCacheService.libraryRoot, welcomeMess, rexMode)
|
||||||
{
|
{
|
||||||
m_Parent = parent;
|
m_Parent = parent;
|
||||||
this.serversInfo = serversInfo;
|
this.serversInfo = serversInfo;
|
||||||
|
@ -64,9 +64,9 @@ namespace OpenSim.Region.Communications.Local
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public override UserProfileData GetTheUser(string firstname, string lastname)
|
public override UserProfileData GetTheUser(string firstname, string lastname, string authAddr)
|
||||||
{
|
{
|
||||||
UserProfileData profile = m_userManager.GetUserProfile(firstname, lastname);
|
UserProfileData profile = m_userManager.GetUserProfile(firstname, lastname, authAddr);
|
||||||
if (profile != null)
|
if (profile != null)
|
||||||
{
|
{
|
||||||
return profile;
|
return profile;
|
||||||
|
@ -79,7 +79,7 @@ namespace OpenSim.Region.Communications.Local
|
||||||
|
|
||||||
m_userManager.AddUserProfile(firstname, lastname, "test", defaultHomeX, defaultHomeY);
|
m_userManager.AddUserProfile(firstname, lastname, "test", defaultHomeX, defaultHomeY);
|
||||||
|
|
||||||
profile = m_userManager.GetUserProfile(firstname, lastname);
|
profile = m_userManager.GetUserProfile(firstname, lastname, "");
|
||||||
if (profile != null)
|
if (profile != null)
|
||||||
{
|
{
|
||||||
m_Parent.InventoryService.CreateNewUserInventory(profile.UUID);
|
m_Parent.InventoryService.CreateNewUserInventory(profile.UUID);
|
||||||
|
@ -112,19 +112,29 @@ namespace OpenSim.Region.Communications.Local
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void CustomiseResponse(LoginResponse response, UserProfileData theUser)
|
public override void CustomiseResponse(LoginResponse response, UserProfileData theUser, string ASaddress)
|
||||||
{
|
{
|
||||||
ulong currentRegion = theUser.currentAgent.currentHandle;
|
ulong currentRegion = theUser.currentAgent.currentHandle;
|
||||||
RegionInfo reg = m_Parent.GridService.RequestNeighbourInfo(currentRegion);
|
RegionInfo reg = m_Parent.GridService.RequestNeighbourInfo(currentRegion);
|
||||||
|
|
||||||
if (reg != null)
|
if (reg != null)
|
||||||
{
|
{
|
||||||
|
// rex, start
|
||||||
|
LLVector3 StartLoc,StartLookAt;
|
||||||
|
bool bCustomStartLoc = true;
|
||||||
|
if (!RexScriptAccess.GetAvatarStartLocation(out StartLoc, out StartLookAt))
|
||||||
|
{
|
||||||
|
StartLoc = theUser.homeLocation;
|
||||||
|
StartLookAt = theUser.homeLocation;
|
||||||
|
bCustomStartLoc = false;
|
||||||
|
}
|
||||||
|
|
||||||
response.Home = "{'region_handle':[r" + (reg.RegionLocX*256).ToString() + ",r" +
|
response.Home = "{'region_handle':[r" + (reg.RegionLocX*256).ToString() + ",r" +
|
||||||
(reg.RegionLocY*256).ToString() + "], " +
|
(reg.RegionLocY*256).ToString() + "], " +
|
||||||
"'position':[r" + theUser.homeLocation.X.ToString() + ",r" +
|
"'position':[r" + StartLoc.X.ToString() + ",r" +
|
||||||
theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "], " +
|
StartLoc.Y.ToString() + ",r" + StartLoc.Z.ToString() + "], " +
|
||||||
"'look_at':[r" + theUser.homeLocation.X.ToString() + ",r" +
|
"'look_at':[r" + StartLoc.X.ToString() + ",r" +
|
||||||
theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "]}";
|
StartLoc.Y.ToString() + ",r" + StartLoc.Z.ToString() + "]}"; // rex end
|
||||||
string capsPath = Util.GetRandomCapsPath();
|
string capsPath = Util.GetRandomCapsPath();
|
||||||
response.SimAddress = reg.ExternalEndPoint.Address.ToString();
|
response.SimAddress = reg.ExternalEndPoint.Address.ToString();
|
||||||
response.SimPort = (uint) reg.ExternalEndPoint.Port;
|
response.SimPort = (uint) reg.ExternalEndPoint.Port;
|
||||||
|
@ -149,9 +159,19 @@ namespace OpenSim.Region.Communications.Local
|
||||||
_login.Session = response.SessionID;
|
_login.Session = response.SessionID;
|
||||||
_login.SecureSession = response.SecureSessionID;
|
_login.SecureSession = response.SecureSessionID;
|
||||||
_login.CircuitCode = (uint) response.CircuitCode;
|
_login.CircuitCode = (uint) response.CircuitCode;
|
||||||
_login.StartPos = new LLVector3(128, 128, 70);
|
if(bCustomStartLoc) // rex
|
||||||
|
_login.StartPos = StartLoc;
|
||||||
|
else
|
||||||
|
_login.StartPos = theUser.currentAgent.currentPos;
|
||||||
_login.CapsPath = capsPath;
|
_login.CapsPath = capsPath;
|
||||||
|
|
||||||
|
_login.ClientVersion = response.ClientVersion; //rex
|
||||||
|
if (m_rexMode)
|
||||||
|
{
|
||||||
|
_login.AuthAddr = theUser.authenticationAddr;
|
||||||
|
_login.asAddress = ASaddress;
|
||||||
|
}
|
||||||
|
|
||||||
if (OnLoginToRegion != null)
|
if (OnLoginToRegion != null)
|
||||||
{
|
{
|
||||||
OnLoginToRegion(currentRegion, _login);
|
OnLoginToRegion(currentRegion, _login);
|
||||||
|
@ -181,26 +201,10 @@ namespace OpenSim.Region.Communications.Local
|
||||||
List<InventoryFolderBase> folders = m_Parent.InventoryService.RequestFirstLevelFolders(userID);
|
List<InventoryFolderBase> folders = m_Parent.InventoryService.RequestFirstLevelFolders(userID);
|
||||||
if (folders.Count > 0)
|
if (folders.Count > 0)
|
||||||
{
|
{
|
||||||
LLUUID rootID = LLUUID.Zero;
|
return GetInventoryData(folders);
|
||||||
ArrayList AgentInventoryArray = new ArrayList();
|
|
||||||
Hashtable TempHash;
|
|
||||||
foreach (InventoryFolderBase InvFolder in folders)
|
|
||||||
{
|
|
||||||
if (InvFolder.parentID == LLUUID.Zero)
|
|
||||||
{
|
|
||||||
rootID = InvFolder.folderID;
|
|
||||||
}
|
}
|
||||||
TempHash = new Hashtable();
|
else {
|
||||||
TempHash["name"] = InvFolder.name;
|
if (!m_rexMode)
|
||||||
TempHash["parent_id"] = InvFolder.parentID.ToString();
|
|
||||||
TempHash["version"] = (Int32) InvFolder.version;
|
|
||||||
TempHash["type_default"] = (Int32) InvFolder.type;
|
|
||||||
TempHash["folder_id"] = InvFolder.folderID.ToString();
|
|
||||||
AgentInventoryArray.Add(TempHash);
|
|
||||||
}
|
|
||||||
return new InventoryData(AgentInventoryArray, rootID);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
AgentInventory userInventory = new AgentInventory();
|
AgentInventory userInventory = new AgentInventory();
|
||||||
userInventory.CreateRootFolder(userID, false);
|
userInventory.CreateRootFolder(userID, false);
|
||||||
|
@ -220,7 +224,38 @@ namespace OpenSim.Region.Communications.Local
|
||||||
|
|
||||||
return new InventoryData(AgentInventoryArray, userInventory.InventoryRoot.FolderID);
|
return new InventoryData(AgentInventoryArray, userInventory.InventoryRoot.FolderID);
|
||||||
}
|
}
|
||||||
|
else { // in rex mode users are created at the authentication server and folders must be created at
|
||||||
|
// first login to db
|
||||||
|
m_Parent.InventoryService.CreateNewUserInventory(userID);
|
||||||
|
|
||||||
|
folders = m_Parent.InventoryService.RequestFirstLevelFolders(userID);
|
||||||
|
return GetInventoryData(folders);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private InventoryData GetInventoryData(List<InventoryFolderBase> folders)
|
||||||
|
{
|
||||||
|
LLUUID rootID = LLUUID.Zero;
|
||||||
|
ArrayList AgentInventoryArray = new ArrayList();
|
||||||
|
Hashtable TempHash;
|
||||||
|
foreach (InventoryFolderBase InvFolder in folders)
|
||||||
|
{
|
||||||
|
if (InvFolder.parentID == LLUUID.Zero)
|
||||||
|
{
|
||||||
|
rootID = InvFolder.folderID;
|
||||||
|
}
|
||||||
|
TempHash = new Hashtable();
|
||||||
|
TempHash["name"] = InvFolder.name;
|
||||||
|
TempHash["parent_id"] = InvFolder.parentID.ToString();
|
||||||
|
TempHash["version"] = (Int32)InvFolder.version;
|
||||||
|
TempHash["type_default"] = (Int32)InvFolder.type;
|
||||||
|
TempHash["folder_id"] = InvFolder.folderID.ToString();
|
||||||
|
AgentInventoryArray.Add(TempHash);
|
||||||
|
}
|
||||||
|
return new InventoryData(AgentInventoryArray, rootID);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -60,7 +60,7 @@ namespace OpenSim.Region.Communications.Local
|
||||||
|
|
||||||
public override UserProfileData SetupMasterUser(string firstName, string lastName, string password)
|
public override UserProfileData SetupMasterUser(string firstName, string lastName, string password)
|
||||||
{
|
{
|
||||||
UserProfileData profile = GetUserProfile(firstName, lastName);
|
UserProfileData profile = GetUserProfile(firstName, lastName, "");
|
||||||
if (profile != null)
|
if (profile != null)
|
||||||
{
|
{
|
||||||
return profile;
|
return profile;
|
||||||
|
@ -69,7 +69,7 @@ namespace OpenSim.Region.Communications.Local
|
||||||
Console.WriteLine("Unknown Master User. Sandbox Mode: Creating Account");
|
Console.WriteLine("Unknown Master User. Sandbox Mode: Creating Account");
|
||||||
AddUserProfile(firstName, lastName, password, m_defaultHomeX, m_defaultHomeY);
|
AddUserProfile(firstName, lastName, password, m_defaultHomeX, m_defaultHomeY);
|
||||||
|
|
||||||
profile = GetUserProfile(firstName, lastName);
|
profile = GetUserProfile(firstName, lastName, "");
|
||||||
|
|
||||||
if (profile == null)
|
if (profile == null)
|
||||||
{
|
{
|
||||||
|
@ -85,7 +85,7 @@ namespace OpenSim.Region.Communications.Local
|
||||||
|
|
||||||
public override UserProfileData SetupMasterUser(LLUUID uuid)
|
public override UserProfileData SetupMasterUser(LLUUID uuid)
|
||||||
{
|
{
|
||||||
UserProfileData data = GetUserProfile(uuid);
|
UserProfileData data = GetUserProfile(uuid, "");
|
||||||
if (data == null)
|
if (data == null)
|
||||||
{
|
{
|
||||||
throw new Exception("Unknown master user UUID");
|
throw new Exception("Unknown master user UUID");
|
||||||
|
|
|
@ -444,6 +444,14 @@ namespace OpenSim.Region.Communications.OGS1
|
||||||
agentData.AgentID = new LLUUID((string) requestData["agent_id"]);
|
agentData.AgentID = new LLUUID((string) requestData["agent_id"]);
|
||||||
agentData.circuitcode = Convert.ToUInt32(requestData["circuit_code"]);
|
agentData.circuitcode = Convert.ToUInt32(requestData["circuit_code"]);
|
||||||
agentData.CapsPath = (string) requestData["caps_path"];
|
agentData.CapsPath = (string) requestData["caps_path"];
|
||||||
|
agentData.ClientVersion = (string)requestData["version"]; //rex
|
||||||
|
|
||||||
|
if (requestData.ContainsKey("auth_addr")) {
|
||||||
|
agentData.authenticationAddr = (string)requestData["auth_addr"];
|
||||||
|
}
|
||||||
|
if (requestData.ContainsKey("as_addr")) {
|
||||||
|
agentData.asAddress = (string)requestData["as_addr"];
|
||||||
|
}
|
||||||
|
|
||||||
if (requestData.ContainsKey("child_agent") && requestData["child_agent"].Equals("1"))
|
if (requestData.ContainsKey("child_agent") && requestData["child_agent"].Equals("1"))
|
||||||
{
|
{
|
||||||
|
|
|
@ -47,6 +47,38 @@ namespace OpenSim.Region.Communications.OGS1
|
||||||
m_parent = parent;
|
m_parent = parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void UpdateUserAgentData(LLUUID agentId, bool agentOnline, LLVector3 currentPos, int logoutTime, string authAddr)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Hashtable param = new Hashtable();
|
||||||
|
param["agentID"] = agentId.ToString();
|
||||||
|
param["agentOnline"] = agentOnline.ToString();
|
||||||
|
param["logoutTime"] = logoutTime.ToString();
|
||||||
|
param["agent_currentPosX"] = Convert.ToSingle(currentPos.X).ToString();
|
||||||
|
param["agent_currentPosY"] = Convert.ToSingle(currentPos.Y).ToString();
|
||||||
|
param["agent_currentPosZ"] = Convert.ToSingle(currentPos.Z).ToString();
|
||||||
|
param["AuthenticationAddress"] = authAddr;
|
||||||
|
IList parameters = new ArrayList();
|
||||||
|
parameters.Add(param);
|
||||||
|
XmlRpcRequest req = new XmlRpcRequest("update_user_agent", parameters);
|
||||||
|
XmlRpcResponse resp = req.Send(m_parent.NetworkServersInfo.UserURL, 3000);
|
||||||
|
Hashtable respData = (Hashtable)resp.Value;
|
||||||
|
|
||||||
|
if ("success" == (string)respData["update"])
|
||||||
|
{
|
||||||
|
MainLog.Instance.Verbose("INTERGRID", "Agent updated with agentID : " + agentId);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (WebException e)
|
||||||
|
{
|
||||||
|
MainLog.Instance.Warn("Error when trying to fetch profile data by name from remote user server: " +
|
||||||
|
e.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public UserProfileData ConvertXMLRPCDataToUserProfile(Hashtable data)
|
public UserProfileData ConvertXMLRPCDataToUserProfile(Hashtable data)
|
||||||
{
|
{
|
||||||
if (data.Contains("error_type"))
|
if (data.Contains("error_type"))
|
||||||
|
@ -131,11 +163,35 @@ namespace OpenSim.Region.Communications.OGS1
|
||||||
return buddylist;
|
return buddylist;
|
||||||
}
|
}
|
||||||
|
|
||||||
public UserProfileData GetUserProfile(string firstName, string lastName)
|
public UserProfileData GetUserProfile(string firstName, string lastName, string authAddr)
|
||||||
{
|
{
|
||||||
return GetUserProfile(firstName + " " + lastName);
|
return GetUserProfile(firstName + " " + lastName, authAddr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public UserProfileData GetUserProfile(string name, string authAddr)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Hashtable param = new Hashtable();
|
||||||
|
param["avatar_name"] = name;
|
||||||
|
param["AuthenticationAddress"] = authAddr;
|
||||||
|
IList parameters = new ArrayList();
|
||||||
|
parameters.Add(param);
|
||||||
|
XmlRpcRequest req = new XmlRpcRequest("get_user_by_name", parameters);
|
||||||
|
XmlRpcResponse resp = req.Send(m_parent.NetworkServersInfo.UserURL, 3000);
|
||||||
|
Hashtable respData = (Hashtable)resp.Value;
|
||||||
|
|
||||||
|
return ConvertXMLRPCDataToUserProfile(respData);
|
||||||
|
}
|
||||||
|
catch (WebException e)
|
||||||
|
{
|
||||||
|
MainLog.Instance.Warn("Error when trying to fetch profile data by name from remote user server: " +
|
||||||
|
e.Message);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public List<AvatarPickerAvatar> GenerateAgentPickerRequestResponse(LLUUID queryID, string query)
|
public List<AvatarPickerAvatar> GenerateAgentPickerRequestResponse(LLUUID queryID, string query)
|
||||||
{
|
{
|
||||||
List<AvatarPickerAvatar> pickerlist = new List<AvatarPickerAvatar>();
|
List<AvatarPickerAvatar> pickerlist = new List<AvatarPickerAvatar>();
|
||||||
|
@ -161,34 +217,14 @@ namespace OpenSim.Region.Communications.OGS1
|
||||||
return pickerlist;
|
return pickerlist;
|
||||||
}
|
}
|
||||||
|
|
||||||
public UserProfileData GetUserProfile(string name)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
Hashtable param = new Hashtable();
|
|
||||||
param["avatar_name"] = name;
|
|
||||||
IList parameters = new ArrayList();
|
|
||||||
parameters.Add(param);
|
|
||||||
XmlRpcRequest req = new XmlRpcRequest("get_user_by_name", parameters);
|
|
||||||
XmlRpcResponse resp = req.Send(m_parent.NetworkServersInfo.UserURL, 3000);
|
|
||||||
Hashtable respData = (Hashtable) resp.Value;
|
|
||||||
|
|
||||||
return ConvertXMLRPCDataToUserProfile(respData);
|
public UserProfileData GetUserProfile(LLUUID avatarID, string authAddr)
|
||||||
}
|
|
||||||
catch (WebException e)
|
|
||||||
{
|
|
||||||
MainLog.Instance.Warn("Error when trying to fetch profile data by name from remote user server: " +
|
|
||||||
e.Message);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public UserProfileData GetUserProfile(LLUUID avatarID)
|
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Hashtable param = new Hashtable();
|
Hashtable param = new Hashtable();
|
||||||
param["avatar_uuid"] = avatarID.ToString();
|
param["avatar_uuid"] = avatarID.ToString();
|
||||||
|
param["AuthenticationAddress"] = authAddr;
|
||||||
IList parameters = new ArrayList();
|
IList parameters = new ArrayList();
|
||||||
parameters.Add(param);
|
parameters.Add(param);
|
||||||
XmlRpcRequest req = new XmlRpcRequest("get_user_by_uuid", parameters);
|
XmlRpcRequest req = new XmlRpcRequest("get_user_by_uuid", parameters);
|
||||||
|
@ -205,9 +241,35 @@ namespace OpenSim.Region.Communications.OGS1
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void clearUserAgent(LLUUID avatarID)
|
public UserProfileData GetUserProfileByAccount(string account)
|
||||||
{
|
{
|
||||||
// TODO: implement
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void clearUserAgent(LLUUID avatarID, string authAddr)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Hashtable param = new Hashtable();
|
||||||
|
param["agentID"] = avatarID.ToString();
|
||||||
|
param["AuthenticationAddress"] = authAddr;
|
||||||
|
IList parameters = new ArrayList();
|
||||||
|
parameters.Add(param);
|
||||||
|
XmlRpcRequest req = new XmlRpcRequest("remove_user_agent", parameters);
|
||||||
|
XmlRpcResponse resp = req.Send(m_parent.NetworkServersInfo.UserURL, 3000);
|
||||||
|
Hashtable respData = (Hashtable)resp.Value;
|
||||||
|
|
||||||
|
Hashtable resh = (Hashtable)resp.Value;
|
||||||
|
if ("success" == (string)resh["remove"])
|
||||||
|
{
|
||||||
|
MainLog.Instance.Verbose("INTERGRID", "Agent removed with agentID : " + avatarID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Console.WriteLine("Error when trying to remove agent data by uuid from remote user server: " +
|
||||||
|
e.Message);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public UserProfileData SetupMasterUser(string firstName, string lastName)
|
public UserProfileData SetupMasterUser(string firstName, string lastName)
|
||||||
|
@ -217,13 +279,13 @@ namespace OpenSim.Region.Communications.OGS1
|
||||||
|
|
||||||
public UserProfileData SetupMasterUser(string firstName, string lastName, string password)
|
public UserProfileData SetupMasterUser(string firstName, string lastName, string password)
|
||||||
{
|
{
|
||||||
UserProfileData profile = GetUserProfile(firstName, lastName);
|
UserProfileData profile = GetUserProfile(firstName, lastName, "");
|
||||||
return profile;
|
return profile;
|
||||||
}
|
}
|
||||||
|
|
||||||
public UserProfileData SetupMasterUser(LLUUID uuid)
|
public UserProfileData SetupMasterUser(LLUUID uuid)
|
||||||
{
|
{
|
||||||
UserProfileData data = GetUserProfile(uuid);
|
UserProfileData data = GetUserProfile(uuid, "");
|
||||||
if (data == null)
|
if (data == null)
|
||||||
{
|
{
|
||||||
throw new Exception("Unknown master user UUID");
|
throw new Exception("Unknown master user UUID");
|
||||||
|
@ -429,5 +491,12 @@ namespace OpenSim.Region.Communications.OGS1
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
public virtual bool AuthenticateUser(LLUUID agentId, String sessionhash, out String avatarstorage)
|
||||||
|
{
|
||||||
|
avatarstorage = "";
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1,284 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Net.Sockets;
|
||||||
|
using System.Net;
|
||||||
|
using OpenSim.Region.Environment.Scenes;
|
||||||
|
using OpenSim.Framework.Console;
|
||||||
|
using OpenSim.Framework.ServerStatus;
|
||||||
|
using OpenSim.Framework;
|
||||||
|
using libsecondlife;
|
||||||
|
|
||||||
|
namespace OpenSim.Region.Communications.VoiceChat
|
||||||
|
{
|
||||||
|
public class VoiceChatServer
|
||||||
|
{
|
||||||
|
Thread m_listenerThread;
|
||||||
|
Thread m_mainThread;
|
||||||
|
Scene m_scene;
|
||||||
|
Socket m_server;
|
||||||
|
Socket m_selectCancel;
|
||||||
|
|
||||||
|
Dictionary<Socket, VoiceClient> m_clients;
|
||||||
|
Dictionary<LLUUID, VoiceClient> m_uuidToClient;
|
||||||
|
|
||||||
|
|
||||||
|
public VoiceChatServer(Scene scene)
|
||||||
|
{
|
||||||
|
m_clients = new Dictionary<Socket, VoiceClient>();
|
||||||
|
m_uuidToClient = new Dictionary<LLUUID, VoiceClient>();
|
||||||
|
m_scene = scene;
|
||||||
|
|
||||||
|
m_scene.EventManager.OnNewPresence += NewPresence;
|
||||||
|
m_scene.EventManager.OnRemovePresence += RemovePresence;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
CreateListeningSocket();
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
MainLog.Instance.Error("VOICECHAT", "Unable to start listening");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_listenerThread = new Thread(new ThreadStart(ListenIncomingConnections));
|
||||||
|
m_listenerThread.IsBackground = true;
|
||||||
|
m_listenerThread.Start();
|
||||||
|
|
||||||
|
m_mainThread = new Thread(new ThreadStart(RunVoiceChat));
|
||||||
|
m_mainThread.IsBackground = true;
|
||||||
|
m_mainThread.Start();
|
||||||
|
|
||||||
|
Thread.Sleep(200);
|
||||||
|
m_selectCancel = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
|
||||||
|
m_selectCancel.Connect("localhost", 59214);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void NewPresence(ScenePresence presence)
|
||||||
|
{
|
||||||
|
MainLog.Instance.Verbose("VOICECHAT", "New scene presence: " + presence.UUID);
|
||||||
|
lock (m_uuidToClient)
|
||||||
|
{
|
||||||
|
m_uuidToClient[presence.UUID] = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RemovePresence(LLUUID uuid)
|
||||||
|
{
|
||||||
|
lock (m_uuidToClient)
|
||||||
|
{
|
||||||
|
if (m_uuidToClient.ContainsKey(uuid))
|
||||||
|
{
|
||||||
|
if (m_uuidToClient[uuid] != null)
|
||||||
|
{
|
||||||
|
RemoveClient(m_uuidToClient[uuid].m_socket);
|
||||||
|
}
|
||||||
|
m_uuidToClient.Remove(uuid);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MainLog.Instance.Error("VOICECHAT", "Presence not found on RemovePresence: " + uuid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool AddClient(VoiceClient client, LLUUID uuid)
|
||||||
|
{
|
||||||
|
lock (m_uuidToClient)
|
||||||
|
{
|
||||||
|
if (m_uuidToClient.ContainsKey(uuid))
|
||||||
|
{
|
||||||
|
if (m_uuidToClient[uuid] != null) {
|
||||||
|
MainLog.Instance.Warn("VOICECHAT", "Multiple login attempts for " + uuid);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
m_uuidToClient[uuid] = client;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RemoveClient(Socket socket)
|
||||||
|
{
|
||||||
|
MainLog.Instance.Verbose("VOICECHAT", "Removing client");
|
||||||
|
lock(m_clients)
|
||||||
|
{
|
||||||
|
VoiceClient client = m_clients[socket];
|
||||||
|
|
||||||
|
lock(m_uuidToClient)
|
||||||
|
{
|
||||||
|
if (m_uuidToClient.ContainsKey(client.m_clientId))
|
||||||
|
{
|
||||||
|
m_uuidToClient[client.m_clientId] = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
m_clients.Remove(socket);
|
||||||
|
client.m_socket.Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void CreateListeningSocket()
|
||||||
|
{
|
||||||
|
IPEndPoint listenEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), 12000);
|
||||||
|
m_server = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
|
||||||
|
m_server.Bind(listenEndPoint);
|
||||||
|
m_server.Listen(50);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ListenIncomingConnections()
|
||||||
|
{
|
||||||
|
MainLog.Instance.Verbose("VOICECHAT", "Listening connections...");
|
||||||
|
ServerStatus.ReportThreadName("VoiceChat: Connection listener");
|
||||||
|
|
||||||
|
byte[] dummyBuffer = new byte[1];
|
||||||
|
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Socket connection = m_server.Accept();
|
||||||
|
lock (m_clients)
|
||||||
|
{
|
||||||
|
m_clients[connection] = new VoiceClient(connection, this);
|
||||||
|
m_selectCancel.Send(dummyBuffer);
|
||||||
|
MainLog.Instance.Verbose("VOICECHAT", "Voicechat connection from " + connection.RemoteEndPoint.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (SocketException e)
|
||||||
|
{
|
||||||
|
MainLog.Instance.Error("VOICECHAT", "During accept: " + e.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Socket ListenLoopbackSocket()
|
||||||
|
{
|
||||||
|
IPEndPoint listenEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), 59214);
|
||||||
|
Socket dummyListener = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
|
||||||
|
dummyListener.Bind(listenEndPoint);
|
||||||
|
dummyListener.Listen(1);
|
||||||
|
Socket socket = dummyListener.Accept();
|
||||||
|
dummyListener.Close();
|
||||||
|
return socket;
|
||||||
|
}
|
||||||
|
|
||||||
|
void RunVoiceChat()
|
||||||
|
{
|
||||||
|
MainLog.Instance.Verbose("VOICECHAT", "Connection handler started...");
|
||||||
|
ServerStatus.ReportThreadName("VoiceChat: Connection handler");
|
||||||
|
|
||||||
|
//Listen a loopback socket for aborting select call
|
||||||
|
Socket dummySocket = ListenLoopbackSocket();
|
||||||
|
|
||||||
|
MainLog.Instance.Verbose("VOICECHAT", "Got select abort socket...");
|
||||||
|
|
||||||
|
List<Socket> sockets = new List<Socket>();
|
||||||
|
byte[] buffer = new byte[65536];
|
||||||
|
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
|
if (m_clients.Count == 0)
|
||||||
|
{
|
||||||
|
Thread.Sleep(100);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
lock (m_clients)
|
||||||
|
{
|
||||||
|
foreach (Socket s in m_clients.Keys)
|
||||||
|
{
|
||||||
|
sockets.Add(s);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sockets.Add(dummySocket);
|
||||||
|
|
||||||
|
Socket.Select(sockets, null, null, 200000);
|
||||||
|
|
||||||
|
foreach (Socket s in sockets)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (s.RemoteEndPoint != dummySocket.RemoteEndPoint)
|
||||||
|
{
|
||||||
|
ReceiveFromSocket(s, buffer);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (s.Receive(buffer) <= 0) {
|
||||||
|
MainLog.Instance.Error("VOICECHAT", "Socket closed");
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
MainLog.Instance.Verbose("VOICECHAT", "Select aborted");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(ObjectDisposedException e)
|
||||||
|
{
|
||||||
|
MainLog.Instance.Warn("VOICECHAT", "Connection has been already closed");
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
MainLog.Instance.Error("VOICECHAT", "Exception: " + e.Message);
|
||||||
|
|
||||||
|
RemoveClient(s);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sockets.Clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ReceiveFromSocket( Socket s, byte[] buffer )
|
||||||
|
{
|
||||||
|
int byteCount = s.Receive(buffer);
|
||||||
|
if (byteCount <= 0)
|
||||||
|
{
|
||||||
|
MainLog.Instance.Verbose("VOICECHAT", "Connection lost to " + s.RemoteEndPoint);
|
||||||
|
lock (m_clients)
|
||||||
|
{
|
||||||
|
RemoveClient(s);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ServerStatus.ReportInPacketTcp(byteCount);
|
||||||
|
lock (m_clients)
|
||||||
|
{
|
||||||
|
if (m_clients.ContainsKey(s))
|
||||||
|
{
|
||||||
|
m_clients[s].OnDataReceived(buffer, byteCount);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MainLog.Instance.Warn("VOICECHAT", "Got data from " + s.RemoteEndPoint +
|
||||||
|
", but it's not registered as a voice client");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void BroadcastVoice(VoicePacket packet)
|
||||||
|
{
|
||||||
|
libsecondlife.LLVector3 origPos = m_scene.GetScenePresence(packet.m_clientId).AbsolutePosition;
|
||||||
|
|
||||||
|
byte[] bytes = packet.GetBytes();
|
||||||
|
foreach (VoiceClient client in m_clients.Values)
|
||||||
|
{
|
||||||
|
if (client.IsEnabled() && client.m_clientId != packet.m_clientId &&
|
||||||
|
client.m_authenticated && client.IsCodecSupported(packet.m_codec))
|
||||||
|
{
|
||||||
|
ScenePresence presence = m_scene.GetScenePresence(client.m_clientId);
|
||||||
|
|
||||||
|
if (presence != null && Util.GetDistanceTo(presence.AbsolutePosition, origPos) < 20)
|
||||||
|
{
|
||||||
|
client.SendTo(bytes);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,175 @@
|
||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using System.Net.Sockets;
|
||||||
|
using OpenSim.Framework.Console;
|
||||||
|
using OpenSim.Framework.ServerStatus;
|
||||||
|
using OpenSim.Region.Environment.Scenes;
|
||||||
|
using libsecondlife;
|
||||||
|
|
||||||
|
namespace OpenSim.Region.Communications.VoiceChat
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Represents a single voiceclient instance
|
||||||
|
**/
|
||||||
|
public class VoiceClient
|
||||||
|
{
|
||||||
|
public Socket m_socket;
|
||||||
|
public LLUUID m_clientId;
|
||||||
|
public bool m_authenticated = false;
|
||||||
|
|
||||||
|
protected VoicePacketHeader m_header = null;
|
||||||
|
protected int m_headerBytesReceived = 0;
|
||||||
|
|
||||||
|
protected int m_offset = 0;
|
||||||
|
protected int m_supportedCodecs = 0;
|
||||||
|
|
||||||
|
protected byte[] m_buffer = null;
|
||||||
|
protected byte[] m_headerBytes = new byte[5];
|
||||||
|
|
||||||
|
protected bool m_enabled = true;
|
||||||
|
|
||||||
|
protected VoiceChatServer m_server;
|
||||||
|
|
||||||
|
public VoiceClient(Socket socket, VoiceChatServer server)
|
||||||
|
{
|
||||||
|
m_socket = socket;
|
||||||
|
m_server = server;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnDataReceived(byte[] data, int byteCount)
|
||||||
|
{
|
||||||
|
/* Console.WriteLine("Got data:");
|
||||||
|
for ( int i = 0; i < byteCount; i++)
|
||||||
|
{
|
||||||
|
Console.Write(data[i] + ", ");
|
||||||
|
}*/
|
||||||
|
|
||||||
|
int offset = 0;
|
||||||
|
while (offset < byteCount)
|
||||||
|
{
|
||||||
|
if (m_header == null)
|
||||||
|
{
|
||||||
|
if (m_headerBytesReceived < 5)
|
||||||
|
{
|
||||||
|
m_headerBytes[m_headerBytesReceived++] = data[offset++];
|
||||||
|
}
|
||||||
|
else if (m_headerBytesReceived == 5)
|
||||||
|
{
|
||||||
|
m_header = new VoicePacketHeader();
|
||||||
|
m_header.Parse(m_headerBytes);
|
||||||
|
if (m_header.length > 65535)
|
||||||
|
{
|
||||||
|
throw new Exception("Packet size " + m_header.length + " > 65535");
|
||||||
|
}
|
||||||
|
|
||||||
|
m_buffer = new byte[m_header.length];
|
||||||
|
m_offset = 0;
|
||||||
|
m_headerBytesReceived = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int bytesToCopy = m_header.length-m_offset;
|
||||||
|
if (bytesToCopy > byteCount - offset)
|
||||||
|
bytesToCopy = byteCount - offset;
|
||||||
|
|
||||||
|
Buffer.BlockCopy(data, offset, m_buffer, m_offset, bytesToCopy);
|
||||||
|
|
||||||
|
offset += bytesToCopy;
|
||||||
|
m_offset += bytesToCopy;
|
||||||
|
|
||||||
|
if (m_offset == m_header.length)
|
||||||
|
{
|
||||||
|
ParsePacket(m_header.type, m_buffer);
|
||||||
|
m_header = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ParsePacket(byte type, byte[] data)
|
||||||
|
{
|
||||||
|
switch (type)
|
||||||
|
{
|
||||||
|
case 0: //LOGIN
|
||||||
|
ParseLogin(data);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 1: //AUDIODATA
|
||||||
|
if (m_authenticated)
|
||||||
|
{
|
||||||
|
VoicePacket packet = new VoicePacket(data);
|
||||||
|
packet.m_clientId = m_clientId;
|
||||||
|
m_server.BroadcastVoice(packet);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MainLog.Instance.Warn("VOICECHAT", "Got unauthorized audio data from " +
|
||||||
|
m_socket.RemoteEndPoint.ToString());
|
||||||
|
m_socket.Close();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 3: //ENABLEVOIP
|
||||||
|
if (data[0] == 0)
|
||||||
|
{
|
||||||
|
MainLog.Instance.Warn("VOICECHAT", "VoiceChat has been disabled for " + m_clientId);
|
||||||
|
m_enabled = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MainLog.Instance.Warn("VOICECHAT", "VoiceChat has been enabled for " + m_clientId);
|
||||||
|
m_enabled = true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
default:
|
||||||
|
throw new Exception("Invalid packet received");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ParseLogin(byte[] data)
|
||||||
|
{
|
||||||
|
m_clientId = new LLUUID(data, 0);
|
||||||
|
|
||||||
|
m_supportedCodecs = data[16];
|
||||||
|
m_supportedCodecs |= data[17] << 8;
|
||||||
|
m_supportedCodecs |= data[18] << 16;
|
||||||
|
m_supportedCodecs |= data[19] << 24;
|
||||||
|
|
||||||
|
if (m_server.AddClient(this, m_clientId))
|
||||||
|
{
|
||||||
|
MainLog.Instance.Verbose("VOICECHAT", "Client authenticated succesfully: " + m_clientId);
|
||||||
|
m_authenticated = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new Exception("Unable to authenticate with id " + m_clientId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsEnabled()
|
||||||
|
{
|
||||||
|
return m_enabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsCodecSupported(int codec)
|
||||||
|
{
|
||||||
|
if ((m_supportedCodecs & codec) != 0)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SendTo(byte[] data)
|
||||||
|
{
|
||||||
|
if (m_authenticated)
|
||||||
|
{
|
||||||
|
ServerStatus.ReportOutPacketTcp(m_socket.Send(data));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,58 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using libsecondlife;
|
||||||
|
|
||||||
|
namespace OpenSim.Region.Communications.VoiceChat
|
||||||
|
{
|
||||||
|
public enum VoiceCodec
|
||||||
|
{
|
||||||
|
None = 0,
|
||||||
|
PCM8 = 1 << 0,
|
||||||
|
PCM16 = 1 << 1,
|
||||||
|
PCM32 = 1 << 2,
|
||||||
|
Speex = 1 << 3,
|
||||||
|
}
|
||||||
|
|
||||||
|
public class VoicePacket
|
||||||
|
{
|
||||||
|
public LLUUID m_clientId;
|
||||||
|
byte[] m_audioData;
|
||||||
|
public int m_codec;
|
||||||
|
|
||||||
|
public VoicePacket(byte[] data)
|
||||||
|
{
|
||||||
|
int pos = 0;
|
||||||
|
m_codec = data[pos++];
|
||||||
|
m_codec |= data[pos++] << 8;
|
||||||
|
m_codec |= data[pos++] << 16;
|
||||||
|
m_codec |= data[pos++] << 24;
|
||||||
|
|
||||||
|
m_audioData = new byte[data.Length - pos];
|
||||||
|
Buffer.BlockCopy(data, pos, m_audioData, 0, data.Length - pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
public byte[] GetBytes()
|
||||||
|
{
|
||||||
|
VoicePacketHeader header = new VoicePacketHeader();
|
||||||
|
byte[] bytes = new byte[5+16+4+m_audioData.Length];
|
||||||
|
|
||||||
|
header.length = bytes.Length-5;
|
||||||
|
|
||||||
|
//ToClient packets are type 2
|
||||||
|
header.type = 2;
|
||||||
|
|
||||||
|
int pos = 0;
|
||||||
|
header.CopyTo(bytes, pos); pos += 5;
|
||||||
|
m_clientId.GetBytes().CopyTo(bytes, pos); pos += 16;
|
||||||
|
|
||||||
|
bytes[pos++] = (byte)((m_codec) % 256);
|
||||||
|
bytes[pos++] = (byte)((m_codec << 8) % 256);
|
||||||
|
bytes[pos++] = (byte)((m_codec << 16) % 256);
|
||||||
|
bytes[pos++] = (byte)((m_codec << 24) % 256);
|
||||||
|
|
||||||
|
m_audioData.CopyTo(bytes, pos);
|
||||||
|
return bytes;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,38 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace OpenSim.Region.Communications.VoiceChat
|
||||||
|
{
|
||||||
|
public class VoicePacketHeader
|
||||||
|
{
|
||||||
|
public byte type;
|
||||||
|
public int length;
|
||||||
|
|
||||||
|
public void Parse(byte[] data)
|
||||||
|
{
|
||||||
|
int offset = 0;
|
||||||
|
type = data[offset++];
|
||||||
|
|
||||||
|
length = data[offset++];
|
||||||
|
length |= data[offset++] << 8;
|
||||||
|
length |= data[offset++] << 16;
|
||||||
|
length |= data[offset++] << 24;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void CopyTo(byte[] data, int offset)
|
||||||
|
{
|
||||||
|
data[offset + 0] = type;
|
||||||
|
|
||||||
|
data[offset + 1] = (byte)(length & 0x000000FF);
|
||||||
|
data[offset + 2] = (byte)((length & 0x0000FF00) >> 8);
|
||||||
|
data[offset + 3] = (byte)((length & 0x00FF0000) >> 16);
|
||||||
|
data[offset + 4] = (byte)((length & 0xFF000000) >> 24);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int GetLength()
|
||||||
|
{
|
||||||
|
return 5;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -449,8 +449,8 @@ namespace OpenSim.Region.Environment
|
||||||
if (splitField.Length == 3)
|
if (splitField.Length == 3)
|
||||||
{
|
{
|
||||||
Int16 corner = Convert.ToInt16(splitField[0]);
|
Int16 corner = Convert.ToInt16(splitField[0]);
|
||||||
float lowValue = (float) Convert.ToDecimal(splitField[1]);
|
float lowValue = (float) Convert.ToDouble(splitField[1].Replace('.', ','));
|
||||||
float highValue = (float) Convert.ToDecimal(splitField[2]);
|
float highValue = (float) Convert.ToDouble(splitField[2].Replace('.', ','));
|
||||||
|
|
||||||
setEstateTextureRange(corner, lowValue, highValue);
|
setEstateTextureRange(corner, lowValue, highValue);
|
||||||
}
|
}
|
||||||
|
|
|
@ -157,6 +157,8 @@ namespace OpenSim.Region.Environment.Modules
|
||||||
// If they are in proximity, then if they are
|
// If they are in proximity, then if they are
|
||||||
// listeners, if so add them to the pending queue
|
// listeners, if so add them to the pending queue
|
||||||
|
|
||||||
|
lock (m_scene.Entities)
|
||||||
|
{
|
||||||
foreach (LLUUID eb in m_scene.Entities.Keys)
|
foreach (LLUUID eb in m_scene.Entities.Keys)
|
||||||
{
|
{
|
||||||
EntityBase sPart;
|
EntityBase sPart;
|
||||||
|
@ -234,7 +236,7 @@ namespace OpenSim.Region.Environment.Modules
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
;
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -178,6 +178,10 @@ namespace OpenSim.Region.Environment
|
||||||
|
|
||||||
if (m_bypassPermissions)
|
if (m_bypassPermissions)
|
||||||
return OwnerMask;
|
return OwnerMask;
|
||||||
|
else //rex
|
||||||
|
{
|
||||||
|
EveryoneMask &= ~(uint)LLObject.ObjectFlags.ObjectModify;
|
||||||
|
}
|
||||||
|
|
||||||
// Object owners should be able to edit their own content
|
// Object owners should be able to edit their own content
|
||||||
if (user == objectOwner)
|
if (user == objectOwner)
|
||||||
|
|
|
@ -37,6 +37,10 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
protected LLUUID m_scenePresenceID;
|
protected LLUUID m_scenePresenceID;
|
||||||
protected int m_wearablesSerial = 1;
|
protected int m_wearablesSerial = 1;
|
||||||
|
|
||||||
|
protected bool m_rexmode; //rex
|
||||||
|
protected string m_avatarStorageAddr;
|
||||||
|
|
||||||
|
|
||||||
protected byte[] m_visualParams;
|
protected byte[] m_visualParams;
|
||||||
|
|
||||||
public byte[] VisualParams
|
public byte[] VisualParams
|
||||||
|
@ -82,6 +86,19 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
m_textureEntry = GetDefaultTextureEntry();
|
m_textureEntry = GetDefaultTextureEntry();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// AvatarAppearance for rexmode, using avatarstorage address for describing avatar
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="avatarID"></param>
|
||||||
|
/// <param name="avatarStorage"></param>
|
||||||
|
public AvatarAppearance(LLUUID avatarID, string avatarStorage)//rex
|
||||||
|
{
|
||||||
|
m_scenePresenceID = avatarID;
|
||||||
|
m_avatarStorageAddr = avatarStorage;
|
||||||
|
m_rexmode = true;
|
||||||
|
m_textureEntry = GetDefaultTextureEntry(); // rex mode fix against nullpointer in SendInitialData()
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -110,21 +127,37 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
/// <param name="avatar"></param>
|
/// <param name="avatar"></param>
|
||||||
public void SendAppearanceToOtherAgent(ScenePresence avatar)
|
public void SendAppearanceToOtherAgent(ScenePresence avatar)
|
||||||
{
|
{
|
||||||
|
if (!m_rexmode) {
|
||||||
avatar.ControllingClient.SendAppearance(m_scenePresenceID, m_visualParams,
|
avatar.ControllingClient.SendAppearance(m_scenePresenceID, m_visualParams,
|
||||||
m_textureEntry.ToBytes());
|
m_textureEntry.ToBytes());
|
||||||
}
|
}
|
||||||
|
else { //rex mode appearance sending
|
||||||
|
avatar.ControllingClient.SendRexAppearance(m_scenePresenceID, m_avatarStorageAddr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void SetWearable(IClientAPI client, int wearableId, AvatarWearable wearable)
|
public void SetWearable(IClientAPI client, int wearableId, AvatarWearable wearable)
|
||||||
|
{
|
||||||
|
if (m_wearables != null) // rex mode fix, wearables may be null
|
||||||
{
|
{
|
||||||
m_wearables[wearableId] = wearable;
|
m_wearables[wearableId] = wearable;
|
||||||
SendOwnWearables(client);
|
SendOwnWearables(client);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void SendOwnWearables(IClientAPI ourClient)
|
public void SendOwnWearables(IClientAPI ourClient)
|
||||||
|
{
|
||||||
|
if (m_wearables != null) // rex mode fix, wearables may be null
|
||||||
{
|
{
|
||||||
ourClient.SendWearables(m_wearables, m_wearablesSerial++);
|
ourClient.SendWearables(m_wearables, m_wearablesSerial++);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m_rexmode) // rex mode addition, send also for the agent itself
|
||||||
|
{
|
||||||
|
ourClient.SendRexAppearance(m_scenePresenceID, m_avatarStorageAddr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static LLObject.TextureEntry GetDefaultTextureEntry()
|
public static LLObject.TextureEntry GetDefaultTextureEntry()
|
||||||
{
|
{
|
||||||
LLObject.TextureEntry textu = new LLObject.TextureEntry(new LLUUID("C228D1CF-4B5D-4BA8-84F4-899A0796AA97"));
|
LLObject.TextureEntry textu = new LLObject.TextureEntry(new LLUUID("C228D1CF-4B5D-4BA8-84F4-899A0796AA97"));
|
||||||
|
|
|
@ -101,6 +101,9 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
set { m_localId = value; }
|
set { m_localId = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// rex, added
|
||||||
|
public bool DeleteMe = false;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a new Entity (should not occur on it's own)
|
/// Creates a new Entity (should not occur on it's own)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -933,6 +933,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
}
|
}
|
||||||
m_numPrim++;
|
m_numPrim++;
|
||||||
copy.ScheduleGroupForFullUpdate();
|
copy.ScheduleGroupForFullUpdate();
|
||||||
|
m_parentScene.EventManager.TriggerOnAddEntity(copy.RootPart.LocalID); // rex, added
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -32,6 +32,8 @@ using libsecondlife.Packets;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Framework.Communications.Cache;
|
using OpenSim.Framework.Communications.Cache;
|
||||||
using OpenSim.Framework.Console;
|
using OpenSim.Framework.Console;
|
||||||
|
using System;
|
||||||
|
using Axiom.Math;
|
||||||
|
|
||||||
namespace OpenSim.Region.Environment.Scenes
|
namespace OpenSim.Region.Environment.Scenes
|
||||||
{
|
{
|
||||||
|
@ -58,9 +60,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
/// in which the item is to be placed.</param>
|
/// in which the item is to be placed.</param>
|
||||||
public void AddInventoryItem(IClientAPI remoteClient, InventoryItemBase item)
|
public void AddInventoryItem(IClientAPI remoteClient, InventoryItemBase item)
|
||||||
{
|
{
|
||||||
CachedUserInfo userInfo
|
CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId);
|
||||||
= CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId);
|
|
||||||
|
|
||||||
if (userInfo != null)
|
if (userInfo != null)
|
||||||
{
|
{
|
||||||
userInfo.AddItem(remoteClient.AgentId, item);
|
userInfo.AddItem(remoteClient.AgentId, item);
|
||||||
|
@ -88,6 +88,30 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
AddInventoryItem(avatar.ControllingClient, item);
|
AddInventoryItem(avatar.ControllingClient, item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// rex, new function related to asset replace
|
||||||
|
public bool CheckInventoryForAsset(LLUUID avatarId, LLUUID assetID)
|
||||||
|
{
|
||||||
|
ScenePresence avatar;
|
||||||
|
|
||||||
|
if (!TryGetAvatar(avatarId, out avatar))
|
||||||
|
{
|
||||||
|
MainLog.Instance.Error(
|
||||||
|
"AGENTINVENTORY", "Could not find avatar {0} to check inventory item for asset", avatarId);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(avatar.ControllingClient.AgentId);
|
||||||
|
if (userInfo != null)
|
||||||
|
{
|
||||||
|
if (userInfo.RootFolder != null)
|
||||||
|
{
|
||||||
|
return userInfo.RootFolder.HasAssetID(assetID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Capability originating call to update the asset of an item in an agent's inventory
|
/// Capability originating call to update the asset of an item in an agent's inventory
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -160,46 +184,27 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
/// <param name="primID">The prim which contains the item to update</param>
|
/// <param name="primID">The prim which contains the item to update</param>
|
||||||
/// <param name="isScriptRunning">Indicates whether the script to update is currently running</param>
|
/// <param name="isScriptRunning">Indicates whether the script to update is currently running</param>
|
||||||
/// <param name="data"></param>
|
/// <param name="data"></param>
|
||||||
|
/// <returns>Asset LLUID created</returns>
|
||||||
public void CapsUpdateTaskInventoryScriptAsset(IClientAPI remoteClient, LLUUID itemId,
|
public void CapsUpdateTaskInventoryScriptAsset(IClientAPI remoteClient, LLUUID itemId,
|
||||||
LLUUID primId, bool isScriptRunning, byte[] data)
|
LLUUID primId, bool isScriptRunning, byte[] data)
|
||||||
{
|
{
|
||||||
// Retrieve group
|
// TODO Not currently doing anything with the isScriptRunning bool
|
||||||
SceneObjectPart part = GetSceneObjectPart(primId);
|
|
||||||
SceneObjectGroup group = part.ParentGroup;
|
MainLog.Instance.Verbose(
|
||||||
if (null == group)
|
|
||||||
{
|
|
||||||
MainLog.Instance.Error(
|
|
||||||
"PRIMINVENTORY",
|
"PRIMINVENTORY",
|
||||||
"Prim inventory update requested for item ID {0} in prim ID {1} but this prim does not exist",
|
"Prim inventory script save functionality not yet implemented."
|
||||||
itemId, primId);
|
+ " remoteClient: {0}, itemID: {1}, primID: {2}, isScriptRunning: {3}",
|
||||||
|
remoteClient, itemId, primId, isScriptRunning);
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
// TODO
|
||||||
|
// Retrieve client LLUID
|
||||||
|
// Retrieve sog containing primID
|
||||||
// Retrieve item
|
// Retrieve item
|
||||||
TaskInventoryItem item = group.GetInventoryItem(part.LocalID, itemId);
|
// Create new asset and add to cache
|
||||||
if (null == item)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create new asset
|
|
||||||
// XXX Hardcoding the numbers is a temporary measure - need an enumeration for this
|
|
||||||
AssetBase asset =
|
|
||||||
CreateAsset(item.name, item.desc, 10, 10, data);
|
|
||||||
AssetCache.AddAsset(asset);
|
|
||||||
|
|
||||||
// Update item with new asset
|
// Update item with new asset
|
||||||
item.asset_id = asset.FullID;
|
// Trigger SOG update (see RezScript)
|
||||||
group.UpdateInventoryItem(item);
|
|
||||||
group.GetProperites(remoteClient);
|
|
||||||
|
|
||||||
// Trigger rerunning of script (use TriggerRezScript event, see RezScript)
|
// Trigger rerunning of script (use TriggerRezScript event, see RezScript)
|
||||||
if (isScriptRunning)
|
// return new asset id
|
||||||
{
|
|
||||||
group.StopScript(part.LocalID, item.item_id);
|
|
||||||
group.StartScript(part.LocalID, item.item_id);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -289,14 +294,14 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MainLog.Instance.Error(
|
MainLog.Instance.Warn(
|
||||||
"AGENTINVENTORY",
|
"AGENTINVENTORY",
|
||||||
"Item ID " + itemID + " not found for an inventory item update.");
|
"Item ID " + itemID + " not found for an inventory item update.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MainLog.Instance.Error(
|
MainLog.Instance.Warn(
|
||||||
"AGENTINVENTORY",
|
"AGENTINVENTORY",
|
||||||
"Agent ID " + remoteClient.AgentId + " not found for an inventory item update.");
|
"Agent ID " + remoteClient.AgentId + " not found for an inventory item update.");
|
||||||
}
|
}
|
||||||
|
@ -311,7 +316,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(oldAgentID);
|
CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(oldAgentID);
|
||||||
if (userInfo == null)
|
if (userInfo == null)
|
||||||
{
|
{
|
||||||
MainLog.Instance.Error("AGENTINVENTORY", "Failed to find user " + oldAgentID.ToString());
|
MainLog.Instance.Warn("AGENTINVENTORY", "Failed to find user " + oldAgentID.ToString());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -320,13 +325,13 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
item = userInfo.RootFolder.HasItem(oldItemID);
|
item = userInfo.RootFolder.HasItem(oldItemID);
|
||||||
if (item == null)
|
if (item == null)
|
||||||
{
|
{
|
||||||
MainLog.Instance.Error("AGENTINVENTORY", "Failed to find item " + oldItemID.ToString());
|
MainLog.Instance.Warn("AGENTINVENTORY", "Failed to find item " + oldItemID.ToString());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MainLog.Instance.Error("AGENTINVENTORY", "Failed to find item " + oldItemID.ToString());
|
MainLog.Instance.Warn("AGENTINVENTORY", "Failed to find item " + oldItemID.ToString());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -357,6 +362,30 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
return asset;
|
return asset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// rex, added function
|
||||||
|
public void RemoveInventoryItem(IClientAPI remoteClient, LLUUID itemID)
|
||||||
|
{
|
||||||
|
MainLog.Instance.Verbose(
|
||||||
|
"AGENTINVENTORY",
|
||||||
|
"Deleting item for " + remoteClient.AgentId.ToString());
|
||||||
|
|
||||||
|
CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId);
|
||||||
|
if (userInfo == null)
|
||||||
|
{
|
||||||
|
MainLog.Instance.Warn("AGENTINVENTORY", "Failed to find user " + remoteClient.AgentId.ToString());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (userInfo.RootFolder != null)
|
||||||
|
{
|
||||||
|
InventoryItemBase item = userInfo.RootFolder.HasItem(itemID);
|
||||||
|
if (item != null)
|
||||||
|
{
|
||||||
|
userInfo.DeleteItem(remoteClient.AgentId, item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void MoveInventoryItem(IClientAPI remoteClient, LLUUID folderID, LLUUID itemID, int length,
|
public void MoveInventoryItem(IClientAPI remoteClient, LLUUID folderID, LLUUID itemID, int length,
|
||||||
string newName)
|
string newName)
|
||||||
{
|
{
|
||||||
|
@ -367,7 +396,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId);
|
CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId);
|
||||||
if (userInfo == null)
|
if (userInfo == null)
|
||||||
{
|
{
|
||||||
MainLog.Instance.Error("AGENTINVENTORY", "Failed to find user " + remoteClient.AgentId.ToString());
|
MainLog.Instance.Warn("AGENTINVENTORY", "Failed to find user " + remoteClient.AgentId.ToString());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -388,13 +417,13 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MainLog.Instance.Error("AGENTINVENTORY", "Failed to find item " + itemID.ToString());
|
MainLog.Instance.Warn("AGENTINVENTORY", "Failed to find item " + itemID.ToString());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MainLog.Instance.Error("AGENTINVENTORY", "Failed to find item " + itemID.ToString() + ", no root folder");
|
MainLog.Instance.Warn("AGENTINVENTORY", "Failed to find item " + itemID.ToString() + ", no root folder");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -497,7 +526,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MainLog.Instance.Error(
|
MainLog.Instance.Warn(
|
||||||
"PRIMINVENTORY", "Inventory requested of prim {0} which doesn't exist", primLocalID);
|
"PRIMINVENTORY", "Inventory requested of prim {0} which doesn't exist", primLocalID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -505,8 +534,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Remove an item from a prim (task) inventory
|
/// Remove an item from a prim (task) inventory
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="remoteClient">Unused at the moment but retained since the avatar ID might
|
/// <param name="remoteClient"></param>
|
||||||
/// be necessary for a permissions check at some stage.</param>
|
|
||||||
/// <param name="itemID"></param>
|
/// <param name="itemID"></param>
|
||||||
/// <param name="localID"></param>
|
/// <param name="localID"></param>
|
||||||
public void RemoveTaskInventory(IClientAPI remoteClient, LLUUID itemID, uint localID)
|
public void RemoveTaskInventory(IClientAPI remoteClient, LLUUID itemID, uint localID)
|
||||||
|
@ -514,7 +542,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
SceneObjectGroup group = GetGroupByPrim(localID);
|
SceneObjectGroup group = GetGroupByPrim(localID);
|
||||||
if (group != null)
|
if (group != null)
|
||||||
{
|
{
|
||||||
int type = group.RemoveInventoryItem(localID, itemID);
|
int type = group.RemoveInventoryItem(remoteClient, localID, itemID);
|
||||||
group.GetProperites(remoteClient);
|
group.GetProperites(remoteClient);
|
||||||
if (type == 10)
|
if (type == 10)
|
||||||
{
|
{
|
||||||
|
@ -523,7 +551,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MainLog.Instance.Error(
|
MainLog.Instance.Warn(
|
||||||
"PRIMINVENTORY",
|
"PRIMINVENTORY",
|
||||||
"Removal of item {0} requested of prim {1} but this prim does not exist",
|
"Removal of item {0} requested of prim {1} but this prim does not exist",
|
||||||
itemID,
|
itemID,
|
||||||
|
@ -686,6 +714,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
|
|
||||||
public void DeleteSceneObjectGroup(SceneObjectGroup group)
|
public void DeleteSceneObjectGroup(SceneObjectGroup group)
|
||||||
{
|
{
|
||||||
|
EventManager.TriggerOnRemoveEntity(group.LocalId); // rex, added
|
||||||
SceneObjectPart rootPart = (group).GetChildPart(group.UUID);
|
SceneObjectPart rootPart = (group).GetChildPart(group.UUID);
|
||||||
if (rootPart.PhysActor != null)
|
if (rootPart.PhysActor != null)
|
||||||
{
|
{
|
||||||
|
@ -747,6 +776,87 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void ObjectAttach(IClientAPI remoteClient, uint localID, LLQuaternion rotation, byte attachPoint)
|
||||||
|
{
|
||||||
|
System.Console.WriteLine("Attaching object " + localID + " to " + attachPoint);
|
||||||
|
SceneObjectPart p = GetSceneObjectPart(localID);
|
||||||
|
ScenePresence av = null;
|
||||||
|
if (TryGetAvatar(remoteClient.AgentId, out av))
|
||||||
|
{
|
||||||
|
p.AttachToAvatar(remoteClient.AgentId, av, attachPoint, rotation, m_regInfo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void ObjectDetach(IClientAPI remoteClient, uint localID)
|
||||||
|
{
|
||||||
|
ScenePresence av = null;
|
||||||
|
if (TryGetAvatar(remoteClient.AgentId, out av))
|
||||||
|
{
|
||||||
|
SceneObjectPart p = GetSceneObjectPart(localID);
|
||||||
|
|
||||||
|
//Place the object in front of the avatar
|
||||||
|
Vector3 vecDir = new Vector3(1, 0, 0);
|
||||||
|
float dist = p.Scale.X + 0.1f;
|
||||||
|
vecDir = (av.Rotation * vecDir) * dist;
|
||||||
|
|
||||||
|
p.ParentGroup.AbsolutePosition = av.AbsolutePosition + new LLVector3(vecDir.x, vecDir.y, vecDir.z);
|
||||||
|
p.RotationOffset = new LLQuaternion(av.Rotation.x, av.Rotation.y, av.Rotation.z, av.Rotation.w);
|
||||||
|
p.Detach();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MainLog.Instance.Warn("SCENE", "Object detach - Unable to find avatar " + remoteClient.FirstName + " " + remoteClient.LastName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void SingleAttachmentFromInv(IClientAPI remoteClient, LLUUID itemID, LLUUID ownerID,
|
||||||
|
uint itemFlags, byte attachPoint)
|
||||||
|
{
|
||||||
|
MainLog.Instance.Verbose("SCENE", "SingleAttachmentFromInv for " + remoteClient.FirstName + " " + remoteClient.LastName + ": " +
|
||||||
|
"itemID=" + itemID + " ownerID=" + ownerID + " itemFlags=" + itemFlags+
|
||||||
|
"attachPoint=" + attachPoint);
|
||||||
|
CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId);
|
||||||
|
if (userInfo != null)
|
||||||
|
{
|
||||||
|
if (userInfo.RootFolder != null)
|
||||||
|
{
|
||||||
|
InventoryItemBase item = userInfo.RootFolder.HasItem(itemID);
|
||||||
|
if (item != null)
|
||||||
|
{
|
||||||
|
AssetBase rezAsset = AssetCache.GetAsset(item.assetID, false);
|
||||||
|
if (rezAsset != null)
|
||||||
|
{
|
||||||
|
MainLog.Instance.Verbose("SCENE", "Adding inventory item to scene");
|
||||||
|
ScenePresence presence = GetScenePresence(remoteClient.AgentId);
|
||||||
|
|
||||||
|
SceneObjectGroup group = new SceneObjectGroup(this, m_regionHandle, Helpers.FieldToUTF8String(rezAsset.Data));
|
||||||
|
group.GenerateNewIDs();
|
||||||
|
AddEntity(group);
|
||||||
|
|
||||||
|
group.AbsolutePosition = presence.AbsolutePosition;
|
||||||
|
SceneObjectPart rootPart = group.GetChildPart(group.UUID);
|
||||||
|
rootPart.RotationOffset = new LLQuaternion(presence.Rotation.x, presence.Rotation.y, presence.Rotation.z, presence.Rotation.w);
|
||||||
|
rootPart.ApplySanePermissions();
|
||||||
|
MainLog.Instance.Verbose("SCENE", "Attaching it to a scene presence");
|
||||||
|
rootPart.AttachToAvatar(remoteClient.AgentId, presence, attachPoint, new LLQuaternion(0, 0, 0, 1), m_regInfo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MainLog.Instance.Warn("SCENE", "RezAttach - Item not found from folder");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MainLog.Instance.Warn("SCENE", "RezAttach - No root folder found");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MainLog.Instance.Warn("SCENE", "RezAttach - Unable to get userInfo for " + remoteClient.FirstName + " " + remoteClient.LastName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void AddRezObject(string xmlData, LLVector3 pos)
|
private void AddRezObject(string xmlData, LLVector3 pos)
|
||||||
{
|
{
|
||||||
SceneObjectGroup group = new SceneObjectGroup(this, m_regionHandle, xmlData);
|
SceneObjectGroup group = new SceneObjectGroup(this, m_regionHandle, xmlData);
|
||||||
|
|
|
@ -176,7 +176,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
agentData.AgentID = avatarID;
|
agentData.AgentID = avatarID;
|
||||||
agentData.QueryID = RequestID;
|
agentData.QueryID = RequestID;
|
||||||
replyPacket.AgentData = agentData;
|
replyPacket.AgentData = agentData;
|
||||||
//byte[] bytes = new byte[AvatarResponses.Count*32];
|
byte[] bytes = new byte[AvatarResponses.Count*32];
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
foreach (AvatarPickerAvatar item in AvatarResponses)
|
foreach (AvatarPickerAvatar item in AvatarResponses)
|
||||||
|
@ -195,5 +195,12 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
replyPacket.Data = searchData;
|
replyPacket.Data = searchData;
|
||||||
client.SendAvatarPickerReply(replyPacket);
|
client.SendAvatarPickerReply(replyPacket);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// rex, added
|
||||||
|
public void ProcessRexClientScriptCommand(IClientAPI remoteClient,LLUUID agentID,List<string> vParams)
|
||||||
|
{
|
||||||
|
EventManager.TriggerOnRexClientScriptCommand(GetScenePresence(agentID), vParams);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,6 +78,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
private readonly Mutex updateLock;
|
private readonly Mutex updateLock;
|
||||||
public bool m_physicalPrim;
|
public bool m_physicalPrim;
|
||||||
public bool m_sendTasksToChild;
|
public bool m_sendTasksToChild;
|
||||||
|
public bool m_rexMode;//rex
|
||||||
private int m_RestartTimerCounter;
|
private int m_RestartTimerCounter;
|
||||||
private readonly Timer m_restartTimer = new Timer(15000); // Wait before firing
|
private readonly Timer m_restartTimer = new Timer(15000); // Wait before firing
|
||||||
private int m_incrementsof15seconds = 0;
|
private int m_incrementsof15seconds = 0;
|
||||||
|
@ -127,6 +128,51 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region realXtend
|
||||||
|
//REX
|
||||||
|
public void UpdateAssetMediaURL(IClientAPI remoteClient, LLUUID itemID, string mediaUrl)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
AssetRequestCallback callback = delegate(LLUUID id, AssetBase asset)
|
||||||
|
{
|
||||||
|
UpdateAssetMediaURLRequest(id, asset, mediaUrl);
|
||||||
|
};
|
||||||
|
|
||||||
|
AssetCache.GetAsset(itemID, callback);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void UpdateAssetMediaURLRequest(LLUUID id, AssetBase asset, string mediaUrl)
|
||||||
|
{
|
||||||
|
if (asset != null)
|
||||||
|
{
|
||||||
|
asset.MediaURL = mediaUrl;
|
||||||
|
AssetCache.ReplaceAsset(asset);
|
||||||
|
|
||||||
|
//Send it to all clients
|
||||||
|
ClientManager.ForEachClient(delegate(IClientAPI client)
|
||||||
|
{
|
||||||
|
client.SendMediaURL(id, mediaUrl);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MainLog.Instance.Verbose("INVENTORY", "Unable to set MediaURL for " + id + ": texture/asset not found");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
public void ClientTriggeredSound(IClientAPI remoteClient, LLUUID soundID, LLUUID ownerID, LLUUID objectID, LLUUID parentID, ulong handle, LLVector3 position, float gain)
|
||||||
|
{
|
||||||
|
ClientManager.ForEachClient(delegate(IClientAPI client)
|
||||||
|
{
|
||||||
|
// TODO: some filtering by distance of avatar
|
||||||
|
client.SendTriggeredSound(soundID, ownerID, objectID, parentID, handle, position, gain);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
#region Properties
|
#region Properties
|
||||||
|
|
||||||
public AgentCircuitManager AuthenticateHandler
|
public AgentCircuitManager AuthenticateHandler
|
||||||
|
@ -211,8 +257,10 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
public Scene(RegionInfo regInfo, AgentCircuitManager authen, PermissionManager permissionManager,
|
public Scene(RegionInfo regInfo, AgentCircuitManager authen, PermissionManager permissionManager,
|
||||||
CommunicationsManager commsMan, SceneCommunicationService sceneGridService,
|
CommunicationsManager commsMan, SceneCommunicationService sceneGridService,
|
||||||
AssetCache assetCach, StorageManager storeManager, BaseHttpServer httpServer,
|
AssetCache assetCach, StorageManager storeManager, BaseHttpServer httpServer,
|
||||||
ModuleLoader moduleLoader, bool dumpAssetsToFile, bool physicalPrim, bool SendTasksToChild)
|
ModuleLoader moduleLoader, bool dumpAssetsToFile, bool physicalPrim, bool SendTasksToChild,
|
||||||
|
bool rexMode)//rex
|
||||||
{
|
{
|
||||||
|
m_rexMode = rexMode;//rex
|
||||||
updateLock = new Mutex(false);
|
updateLock = new Mutex(false);
|
||||||
|
|
||||||
m_moduleLoader = moduleLoader;
|
m_moduleLoader = moduleLoader;
|
||||||
|
@ -722,6 +770,20 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// rex, new function
|
||||||
|
public bool ForcedBackup()
|
||||||
|
{
|
||||||
|
List<EntityBase> EntitiesList = GetEntities();
|
||||||
|
foreach (EntityBase ent in EntitiesList)
|
||||||
|
{
|
||||||
|
if (ent is SceneObjectGroup)
|
||||||
|
{
|
||||||
|
((SceneObjectGroup)ent).HasChanged = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Backup();
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Load Terrain
|
#region Load Terrain
|
||||||
|
@ -907,8 +969,11 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
rootPart.AbsolutePosition.Z),
|
rootPart.AbsolutePosition.Z),
|
||||||
new PhysicsVector(rootPart.Scale.X, rootPart.Scale.Y, rootPart.Scale.Z),
|
new PhysicsVector(rootPart.Scale.X, rootPart.Scale.Y, rootPart.Scale.Z),
|
||||||
new Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X,
|
new Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X,
|
||||||
rootPart.RotationOffset.Y, rootPart.RotationOffset.Z), UsePhysics);
|
rootPart.RotationOffset.Y, rootPart.RotationOffset.Z), UsePhysics, rootPart.LocalID);
|
||||||
rootPart.DoPhysicsPropertyUpdate(UsePhysics, true);
|
rootPart.DoPhysicsPropertyUpdate(UsePhysics, true);
|
||||||
|
// rex added, load 3d collision model.
|
||||||
|
rootPart.GetRexParameters();
|
||||||
|
rootPart.RexUpdateCollisionMesh();
|
||||||
}
|
}
|
||||||
|
|
||||||
MainLog.Instance.Verbose("SCENE", "Loaded " + PrimsFromDB.Count.ToString() + " SceneObject(s)");
|
MainLog.Instance.Verbose("SCENE", "Loaded " + PrimsFromDB.Count.ToString() + " SceneObject(s)");
|
||||||
|
@ -1053,14 +1118,58 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
rootPart.Shape,
|
rootPart.Shape,
|
||||||
new PhysicsVector(pos.X, pos.Y, pos.Z),
|
new PhysicsVector(pos.X, pos.Y, pos.Z),
|
||||||
new PhysicsVector(shape.Scale.X, shape.Scale.Y, shape.Scale.Z),
|
new PhysicsVector(shape.Scale.X, shape.Scale.Y, shape.Scale.Z),
|
||||||
new Quaternion(), UsePhysics);
|
new Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X,
|
||||||
|
rootPart.RotationOffset.Y, rootPart.RotationOffset.Z), UsePhysics, rootPart.LocalID); // rex, use rootPart.RotationOffset as rotation
|
||||||
// subscribe to physics events.
|
// subscribe to physics events.
|
||||||
rootPart.DoPhysicsPropertyUpdate(UsePhysics, true);
|
rootPart.DoPhysicsPropertyUpdate(UsePhysics, true);
|
||||||
|
// rex added, load 3d collision model
|
||||||
|
rootPart.GetRexParameters();
|
||||||
|
rootPart.RexUpdateCollisionMesh();
|
||||||
}
|
}
|
||||||
|
EventManager.TriggerOnAddEntity(rootPart.LocalID); // rex, added
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// rex, new function
|
||||||
|
public uint AddNewPrimReturningId(LLUUID ownerID, LLVector3 pos, LLQuaternion rot, PrimitiveBaseShape shape, bool vbTemp, string vPyClass)
|
||||||
|
{
|
||||||
|
SceneObjectGroup sceneOb =
|
||||||
|
new SceneObjectGroup(this, m_regionHandle, ownerID, PrimIDAllocate(), pos, rot, shape, vbTemp, vPyClass);
|
||||||
|
AddEntity(sceneOb);
|
||||||
|
SceneObjectPart rootPart = sceneOb.GetChildPart(sceneOb.UUID);
|
||||||
|
// if grass or tree, make phantom
|
||||||
|
//rootPart.ApplySanePermissions();
|
||||||
|
if ((rootPart.Shape.PCode == 95) || (rootPart.Shape.PCode == 255) || (rootPart.Shape.PCode == 111))
|
||||||
|
{
|
||||||
|
rootPart.AddFlag(LLObject.ObjectFlags.Phantom);
|
||||||
|
//rootPart.ObjectFlags += (uint)LLObject.ObjectFlags.Phantom;
|
||||||
|
}
|
||||||
|
// if not phantom, add to physics
|
||||||
|
bool UsePhysics = (((rootPart.ObjectFlags & (uint)LLObject.ObjectFlags.Physics) > 0) && m_physicalPrim);
|
||||||
|
if ((rootPart.ObjectFlags & (uint)LLObject.ObjectFlags.Phantom) == 0)
|
||||||
|
{
|
||||||
|
rootPart.PhysActor =
|
||||||
|
PhysicsScene.AddPrimShape(
|
||||||
|
rootPart.Name,
|
||||||
|
rootPart.Shape,
|
||||||
|
new PhysicsVector(pos.X, pos.Y, pos.Z),
|
||||||
|
new PhysicsVector(shape.Scale.X, shape.Scale.Y, shape.Scale.Z),
|
||||||
|
new Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X,
|
||||||
|
rootPart.RotationOffset.Y, rootPart.RotationOffset.Z), UsePhysics, rootPart.LocalID); // rex, use rootPart.RotationOffset as rotation
|
||||||
|
// subscribe to physics events.
|
||||||
|
rootPart.DoPhysicsPropertyUpdate(UsePhysics, true);
|
||||||
|
// rex added, load 3d collision model
|
||||||
|
rootPart.GetRexParameters();
|
||||||
|
rootPart.RexUpdateCollisionMesh();
|
||||||
|
}
|
||||||
|
EventManager.TriggerOnAddEntity(rootPart.LocalID); // rex, added
|
||||||
|
return rootPart.LocalID;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void AddTree(LLVector3 scale, LLQuaternion rotation, LLVector3 position,
|
public void AddTree(LLVector3 scale, LLQuaternion rotation, LLVector3 position,
|
||||||
Tree treeType, bool newTree)
|
libsecondlife.Tree treeType, bool newTree)
|
||||||
{
|
{
|
||||||
PrimitiveBaseShape treeShape = new PrimitiveBaseShape();
|
PrimitiveBaseShape treeShape = new PrimitiveBaseShape();
|
||||||
treeShape.PathCurve = 16;
|
treeShape.PathCurve = 16;
|
||||||
|
@ -1137,15 +1246,65 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
/// <param name="child"></param>
|
/// <param name="child"></param>
|
||||||
public override void AddNewClient(IClientAPI client, bool child)
|
public override void AddNewClient(IClientAPI client, bool child)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
|
String storageaddress;
|
||||||
|
|
||||||
|
if (!CommsManager.UserService.AuthenticateUser(client.AgentId, client.SessionId.ToString(), out storageaddress)) {
|
||||||
|
client.Kick("User authentication failed.");
|
||||||
|
}
|
||||||
|
else { // first authenticate and then do inits //rex
|
||||||
SubscribeToClientEvents(client);
|
SubscribeToClientEvents(client);
|
||||||
|
|
||||||
m_estateManager.sendRegionHandshake(client);
|
m_estateManager.sendRegionHandshake(client);
|
||||||
|
if (!m_rexMode) {
|
||||||
CreateAndAddScenePresence(client, child);
|
CreateAndAddScenePresence(client, child);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
CreateAndAddRexScenePresence(client, child, storageaddress);
|
||||||
|
}
|
||||||
m_LandManager.sendParcelOverlay(client);
|
m_LandManager.sendParcelOverlay(client);
|
||||||
|
string authAddr = m_authenticateHandler.AgentCircuits[client.CircuitCode].authenticationAddr;
|
||||||
|
|
||||||
|
if (m_rexMode)
|
||||||
|
{
|
||||||
|
CommsManager.UserProfileCacheService.AddNewUser(client.AgentId, authAddr);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
CommsManager.UserProfileCacheService.AddNewUser(client.AgentId);
|
CommsManager.UserProfileCacheService.AddNewUser(client.AgentId);
|
||||||
|
}
|
||||||
|
|
||||||
CommsManager.TransactionsManager.AddUser(client.AgentId);
|
CommsManager.TransactionsManager.AddUser(client.AgentId);
|
||||||
|
}/*/
|
||||||
|
SubscribeToClientEvents(client);
|
||||||
|
m_estateManager.sendRegionHandshake(client);
|
||||||
|
if (!m_rexMode)
|
||||||
|
{
|
||||||
|
CreateAndAddScenePresence(client, child);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!m_authenticateHandler.AgentCircuits.ContainsKey(client.CircuitCode))
|
||||||
|
{
|
||||||
|
client.Kick("User login failed. No circuit code.");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CreateAndAddRexScenePresence(client, child, m_authenticateHandler.AgentCircuits[client.CircuitCode].asAddress);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
m_LandManager.sendParcelOverlay(client);
|
||||||
|
string authAddr = m_authenticateHandler.AgentCircuits[client.CircuitCode].authenticationAddr;
|
||||||
|
if (m_rexMode)
|
||||||
|
{
|
||||||
|
CommsManager.UserProfileCacheService.AddNewUser(client.AgentId, authAddr);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CommsManager.UserProfileCacheService.AddNewUser(client.AgentId);
|
||||||
|
}
|
||||||
|
|
||||||
|
CommsManager.TransactionsManager.AddUser(client.AgentId);
|
||||||
|
//*/
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual void SubscribeToClientEvents(IClientAPI client)
|
protected virtual void SubscribeToClientEvents(IClientAPI client)
|
||||||
|
@ -1208,10 +1367,15 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
client.OnUpdateInventoryItem += UpdateInventoryItemAsset;
|
client.OnUpdateInventoryItem += UpdateInventoryItemAsset;
|
||||||
client.OnCopyInventoryItem += CopyInventoryItem;
|
client.OnCopyInventoryItem += CopyInventoryItem;
|
||||||
client.OnMoveInventoryItem += MoveInventoryItem;
|
client.OnMoveInventoryItem += MoveInventoryItem;
|
||||||
|
client.OnRemoveInventoryItem += RemoveInventoryItem; // rex
|
||||||
client.OnAssetUploadRequest += CommsManager.TransactionsManager.HandleUDPUploadRequest;
|
client.OnAssetUploadRequest += CommsManager.TransactionsManager.HandleUDPUploadRequest;
|
||||||
client.OnXferReceive += CommsManager.TransactionsManager.HandleXfer;
|
client.OnXferReceive += CommsManager.TransactionsManager.HandleXfer;
|
||||||
client.OnRezScript += RezScript;
|
client.OnRezScript += RezScript;
|
||||||
|
|
||||||
|
client.OnRezSingleAttachmentFromInv += SingleAttachmentFromInv;
|
||||||
|
client.OnObjectAttach += ObjectAttach;
|
||||||
|
client.OnObjectDetach += ObjectDetach;
|
||||||
|
|
||||||
client.OnRequestTaskInventory += RequestTaskInventory;
|
client.OnRequestTaskInventory += RequestTaskInventory;
|
||||||
client.OnRemoveTaskItem += RemoveTaskInventory;
|
client.OnRemoveTaskItem += RemoveTaskInventory;
|
||||||
client.OnUpdateTaskInventory += UpdateTaskInventory;
|
client.OnUpdateTaskInventory += UpdateTaskInventory;
|
||||||
|
@ -1219,23 +1383,38 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
client.OnGrabObject += ProcessObjectGrab;
|
client.OnGrabObject += ProcessObjectGrab;
|
||||||
client.OnAvatarPickerRequest += ProcessAvatarPickerRequest;
|
client.OnAvatarPickerRequest += ProcessAvatarPickerRequest;
|
||||||
|
|
||||||
|
client.OnReceiveRexClientScriptCmd += ProcessRexClientScriptCommand; // rex
|
||||||
|
client.OnObjectClickAction += HandleObjectClickAction; // rex
|
||||||
|
client.OnUpdateAssetMediaURL += UpdateAssetMediaURL; // rex
|
||||||
|
|
||||||
|
client.OnTriggerSound += ClientTriggeredSound;
|
||||||
|
|
||||||
EventManager.TriggerOnNewClient(client);
|
EventManager.TriggerOnNewClient(client);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual ScenePresence CreateAndAddScenePresence(IClientAPI client, bool child)
|
protected virtual ScenePresence CreateAndAddScenePresence(IClientAPI client, bool child)
|
||||||
{
|
{
|
||||||
ScenePresence avatar = null;
|
|
||||||
|
|
||||||
AvatarAppearance appearance;
|
AvatarAppearance appearance;
|
||||||
GetAvatarAppearance(client, out appearance);
|
GetAvatarAppearance(client, out appearance);
|
||||||
|
return CreateAndAddScenePresenceCommon(client, child, appearance);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected virtual ScenePresence CreateAndAddRexScenePresence(IClientAPI client, bool child, string avatarstorage) //rex
|
||||||
|
{
|
||||||
|
AvatarAppearance appearance;
|
||||||
|
appearance = new AvatarAppearance(client.AgentId, avatarstorage);
|
||||||
|
return CreateAndAddScenePresenceCommon(client, child, appearance);
|
||||||
|
}
|
||||||
|
|
||||||
|
private ScenePresence CreateAndAddScenePresenceCommon(IClientAPI client, bool child, AvatarAppearance appearance)
|
||||||
|
{
|
||||||
|
ScenePresence avatar = null;
|
||||||
avatar = m_innerScene.CreateAndAddScenePresence(client, child, appearance);
|
avatar = m_innerScene.CreateAndAddScenePresence(client, child, appearance);
|
||||||
|
|
||||||
if (avatar.IsChildAgent)
|
if (avatar.IsChildAgent)
|
||||||
{
|
{
|
||||||
avatar.OnSignificantClientMovement += m_LandManager.handleSignificantClientMovement;
|
avatar.OnSignificantClientMovement += m_LandManager.handleSignificantClientMovement;
|
||||||
}
|
}
|
||||||
|
EventManager.TriggerOnNewPresence(avatar);//rex
|
||||||
return avatar;
|
return avatar;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1257,8 +1436,51 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="agentID"></param>
|
/// <param name="agentID"></param>
|
||||||
public override void RemoveClient(LLUUID agentID)
|
public override void RemoveClient(LLUUID agentID)
|
||||||
|
{
|
||||||
|
CommonRemoveClient(agentID);
|
||||||
|
// Remove client agent from profile, so new logins will work
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Called in rex mode
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="agentID"></param>
|
||||||
|
/// <param name="circuitCode"></param>
|
||||||
|
public override void RemoveClient(LLUUID agentID, uint circuitCode)
|
||||||
{
|
{
|
||||||
ScenePresence avatar = GetScenePresence(agentID);
|
ScenePresence avatar = GetScenePresence(agentID);
|
||||||
|
string authAddr = m_authenticateHandler.AgentCircuits[circuitCode].authenticationAddr;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
|
||||||
|
float x = Convert.ToSingle(Math.Round(avatar.AbsolutePosition.X));
|
||||||
|
float y = Convert.ToSingle(Math.Round(avatar.AbsolutePosition.Y));
|
||||||
|
float z = Convert.ToSingle(Math.Round(avatar.AbsolutePosition.Z));
|
||||||
|
LLVector3 currentPos = new LLVector3(x, y, z);
|
||||||
|
|
||||||
|
if (authAddr != null)
|
||||||
|
{
|
||||||
|
CommsManager.UserService.UpdateUserAgentData(agentID, false, currentPos, Util.UnixTimeSinceEpoch(), authAddr);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CommsManager.UserService.UpdateUserAgentData(agentID, false, currentPos, Util.UnixTimeSinceEpoch(), "");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Console.WriteLine(e.ToString());
|
||||||
|
}
|
||||||
|
CommonRemoveClient(agentID);
|
||||||
|
CommsManager.UserService.clearUserAgent(agentID, authAddr);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CommonRemoveClient(LLUUID agentID)
|
||||||
|
{
|
||||||
|
ScenePresence avatar = GetScenePresence(agentID);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (avatar.IsChildAgent)
|
if (avatar.IsChildAgent)
|
||||||
|
@ -1314,10 +1536,10 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
MainLog.Instance.Error("Scene.cs:RemoveClient exception: " + e.ToString());
|
MainLog.Instance.Error("Scene.cs:RemoveClient exception: " + e.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove client agent from profile, so new logins will work
|
|
||||||
CommsManager.UserService.clearUserAgent(agentID);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public override void CloseAllAgents(uint circuitcode)
|
public override void CloseAllAgents(uint circuitcode)
|
||||||
{
|
{
|
||||||
// Called by ClientView to kill all circuit codes
|
// Called by ClientView to kill all circuit codes
|
||||||
|
@ -1413,6 +1635,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
|
|
||||||
}
|
}
|
||||||
cap.AddNewInventoryItem = AddInventoryItem;
|
cap.AddNewInventoryItem = AddInventoryItem;
|
||||||
|
cap.CheckInventoryForAsset = CheckInventoryForAsset;
|
||||||
cap.ItemUpdatedCall = CapsUpdateInventoryItemAsset;
|
cap.ItemUpdatedCall = CapsUpdateInventoryItemAsset;
|
||||||
cap.TaskScriptUpdatedCall = CapsUpdateTaskInventoryScriptAsset;
|
cap.TaskScriptUpdatedCall = CapsUpdateTaskInventoryScriptAsset;
|
||||||
|
|
||||||
|
@ -1669,6 +1892,14 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SendDialogToUser(LLUUID avatarID, string objectName, LLUUID objectID, LLUUID ownerID, string message, LLUUID TextureID, int ch, string[] buttonlabels)
|
||||||
|
{
|
||||||
|
if (m_scenePresences.ContainsKey(avatarID))
|
||||||
|
{
|
||||||
|
m_scenePresences[avatarID].ControllingClient.SendDialog(objectName, objectID, ownerID, message, TextureID, ch, buttonlabels);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -1953,6 +2184,22 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//REX
|
||||||
|
public void HandleObjectClickAction(IClientAPI controller, uint objId, byte clickAction)
|
||||||
|
{
|
||||||
|
SceneObjectPart objectPart = GetSceneObjectPart(objId);
|
||||||
|
if (objectPart != null && PermissionsMngr.CanEditObject(controller.AgentId, objectPart.UUID))
|
||||||
|
{
|
||||||
|
objectPart.ClickAction = clickAction;
|
||||||
|
MainLog.Instance.Verbose("SCENE", "Updating clickaction");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MainLog.Instance.Verbose("SCENE", "Tried updating clickaction, but object was not found or incorrect permission");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -2163,6 +2410,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
|
|
||||||
#region InnerScene wrapper methods
|
#region InnerScene wrapper methods
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -84,6 +84,14 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
set { m_regStatus = value; }
|
set { m_regStatus = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool RexMode
|
||||||
|
{
|
||||||
|
get { return m_rexMode; }
|
||||||
|
set { m_rexMode = value; }
|
||||||
|
}
|
||||||
|
public bool m_rexMode;
|
||||||
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Update Methods
|
#region Update Methods
|
||||||
|
@ -128,6 +136,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="agentID"></param>
|
/// <param name="agentID"></param>
|
||||||
public abstract void RemoveClient(LLUUID agentID);
|
public abstract void RemoveClient(LLUUID agentID);
|
||||||
|
public abstract void RemoveClient(LLUUID agentID, uint circuitCode);
|
||||||
|
|
||||||
public abstract void CloseAllAgents(uint circuitcode);
|
public abstract void CloseAllAgents(uint circuitcode);
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
|
|
||||||
using libsecondlife;
|
using libsecondlife;
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Region.Environment.Interfaces;
|
using OpenSim.Region.Environment.Interfaces;
|
||||||
using OpenSim.Region.Environment.LandManagement;
|
using OpenSim.Region.Environment.LandManagement;
|
||||||
|
@ -125,7 +126,25 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
|
|
||||||
public event NewGridInstantMessage OnGridInstantMessageToGroupsModule;
|
public event NewGridInstantMessage OnGridInstantMessageToGroupsModule;
|
||||||
|
|
||||||
|
// rex, new events
|
||||||
|
public delegate void OnAddEntityDelegate(uint localID);
|
||||||
|
public event OnAddEntityDelegate OnAddEntity;
|
||||||
|
|
||||||
|
public delegate void OnRemoveEntityDelegate(uint localID);
|
||||||
|
public event OnRemoveEntityDelegate OnRemoveEntity;
|
||||||
|
|
||||||
|
public delegate void OnPythonScriptCommandDelegate(string vCommand);
|
||||||
|
public event OnPythonScriptCommandDelegate OnPythonScriptCommand;
|
||||||
|
|
||||||
|
public delegate void OnChangePythonClassDelegate(uint localID);
|
||||||
|
public event OnChangePythonClassDelegate OnPythonClassChange;
|
||||||
|
|
||||||
|
public delegate void OnRexScriptCommandDelegate(ScenePresence avatar,List<string> vCommands);
|
||||||
|
public event OnRexScriptCommandDelegate OnRexClientScriptCommand;
|
||||||
|
|
||||||
|
public delegate void OnPrimVolumeCollisionDelegate(uint ownID, uint colliderID);
|
||||||
|
public event OnPrimVolumeCollisionDelegate OnPrimVolumeCollision;
|
||||||
|
// rex-end
|
||||||
|
|
||||||
public void TriggerOnClientMovement(ScenePresence avatar)
|
public void TriggerOnClientMovement(ScenePresence avatar)
|
||||||
{
|
{
|
||||||
|
@ -301,5 +320,48 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// rex, new function
|
||||||
|
public void TriggerOnAddEntity(uint localID)
|
||||||
|
{
|
||||||
|
if (OnAddEntity != null)
|
||||||
|
OnAddEntity(localID);
|
||||||
|
}
|
||||||
|
|
||||||
|
// rex, new function
|
||||||
|
public void TriggerOnRemoveEntity(uint localID)
|
||||||
|
{
|
||||||
|
if (OnRemoveEntity != null)
|
||||||
|
OnRemoveEntity(localID);
|
||||||
|
}
|
||||||
|
|
||||||
|
// rex, new function
|
||||||
|
public void TriggerOnPythonScriptCommand(string vCommand)
|
||||||
|
{
|
||||||
|
if (OnPythonScriptCommand != null)
|
||||||
|
OnPythonScriptCommand(vCommand);
|
||||||
|
}
|
||||||
|
|
||||||
|
// rex, new function
|
||||||
|
public void TriggerOnChangePythonClass(uint localID)
|
||||||
|
{
|
||||||
|
if (OnPythonClassChange != null)
|
||||||
|
OnPythonClassChange(localID);
|
||||||
|
}
|
||||||
|
|
||||||
|
// rex, new function
|
||||||
|
public void TriggerOnRexClientScriptCommand(ScenePresence avatar, List<string> vCommands)
|
||||||
|
{
|
||||||
|
if (OnRexClientScriptCommand != null)
|
||||||
|
OnRexClientScriptCommand(avatar, vCommands);
|
||||||
|
}
|
||||||
|
|
||||||
|
// rex, new function
|
||||||
|
public void TriggerOnPrimVolumeCollision(uint ownID,uint colliderID)
|
||||||
|
{
|
||||||
|
if (OnPrimVolumeCollision != null)
|
||||||
|
OnPrimVolumeCollision(ownID, colliderID);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -196,6 +196,12 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
ForEachCurrentScene(delegate(Scene scene) { scene.SendCommandToPlugins(cmdparams); });
|
ForEachCurrentScene(delegate(Scene scene) { scene.SendCommandToPlugins(cmdparams); });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// rex new function
|
||||||
|
public void SendPythonScriptCommand(string[] cmdparams)
|
||||||
|
{
|
||||||
|
ForEachCurrentScene(delegate(Scene scene) { scene.EventManager.TriggerOnPythonScriptCommand(cmdparams[0]); });
|
||||||
|
}
|
||||||
|
|
||||||
public void SetBypassPermissionsOnCurrentScene(bool bypassPermissions)
|
public void SetBypassPermissionsOnCurrentScene(bool bypassPermissions)
|
||||||
{
|
{
|
||||||
ForEachCurrentScene(delegate(Scene scene) { scene.PermissionsMngr.BypassPermissions = bypassPermissions; });
|
ForEachCurrentScene(delegate(Scene scene) { scene.PermissionsMngr.BypassPermissions = bypassPermissions; });
|
||||||
|
@ -223,6 +229,12 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
ForEachCurrentScene(delegate(Scene scene) { scene.Backup(); });
|
ForEachCurrentScene(delegate(Scene scene) { scene.Backup(); });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// rex, new function
|
||||||
|
public void ForcedBackupCurrentScene()
|
||||||
|
{
|
||||||
|
ForEachCurrentScene(delegate(Scene scene) { scene.ForcedBackup(); });
|
||||||
|
}
|
||||||
|
|
||||||
public void HandleAlertCommandOnCurrentScene(string[] cmdparams)
|
public void HandleAlertCommandOnCurrentScene(string[] cmdparams)
|
||||||
{
|
{
|
||||||
ForEachCurrentScene(delegate(Scene scene) { scene.HandleAlertCommand(cmdparams); });
|
ForEachCurrentScene(delegate(Scene scene) { scene.HandleAlertCommand(cmdparams); });
|
||||||
|
|
|
@ -60,27 +60,6 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// /// Start a given script.
|
|
||||||
// /// </summary>
|
|
||||||
// /// <param name="localID">
|
|
||||||
// /// A <see cref="System.UInt32"/>
|
|
||||||
// /// </param>
|
|
||||||
// public void StartScript(LLUUID partID, LLUUID itemID)
|
|
||||||
// {
|
|
||||||
// SceneObjectPart part = GetChildPart(partID);
|
|
||||||
// if (part != null)
|
|
||||||
// {
|
|
||||||
// part.StartScript(itemID);
|
|
||||||
// }
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
// MainLog.Instance.Error(
|
|
||||||
// "PRIMINVENTORY",
|
|
||||||
// "Couldn't find part {0} in object group {1}, {2} to start script with ID {3}",
|
|
||||||
// localID, Name, UUID, itemID);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Start the scripts contained in all the prims in this group.
|
/// Start the scripts contained in all the prims in this group.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -92,27 +71,6 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Start a given script.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="localID">
|
|
||||||
/// A <see cref="System.UInt32"/>
|
|
||||||
/// </param>
|
|
||||||
public void StopScript(uint partID, LLUUID itemID)
|
|
||||||
{
|
|
||||||
SceneObjectPart part = GetChildPart(partID);
|
|
||||||
if (part != null)
|
|
||||||
{
|
|
||||||
part.StopScript(itemID);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
MainLog.Instance.Error(
|
|
||||||
"PRIMINVENTORY",
|
|
||||||
"Couldn't find part {0} in object group {1}, {2} to stop script with ID {3}",
|
|
||||||
partID, Name, UUID, itemID);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -199,62 +157,12 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
public int RemoveInventoryItem(IClientAPI remoteClient, uint localID, LLUUID itemID)
|
||||||
/// Returns an existing inventory item. Returns the original, so any changes will be live.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="primID"></param>
|
|
||||||
/// <param name="itemID"></param>
|
|
||||||
/// <returns>null if the item does not exist</returns>
|
|
||||||
public TaskInventoryItem GetInventoryItem(uint primID, LLUUID itemID)
|
|
||||||
{
|
|
||||||
SceneObjectPart part = GetChildPart(primID);
|
|
||||||
if (part != null)
|
|
||||||
{
|
|
||||||
return part.GetInventoryItem(itemID);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
MainLog.Instance.Error(
|
|
||||||
"PRIMINVENTORY",
|
|
||||||
"Couldn't find prim local ID {0} in prim {1}, {2} to get inventory item ID {3}",
|
|
||||||
primID, part.Name, part.UUID, itemID);
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Update an existing inventory item.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="item">The updated item. An item with the same id must already exist
|
|
||||||
/// in this prim's inventory</param>
|
|
||||||
/// <returns>false if the item did not exist, true if the update occurred succesfully</returns>
|
|
||||||
public bool UpdateInventoryItem(TaskInventoryItem item)
|
|
||||||
{
|
|
||||||
SceneObjectPart part = GetChildPart(item.ParentPartID);
|
|
||||||
if (part != null)
|
|
||||||
{
|
|
||||||
part.UpdateInventoryItem(item);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
MainLog.Instance.Error(
|
|
||||||
"PRIMINVENTORY",
|
|
||||||
"Couldn't find prim ID {0} to update item {1}, {2}",
|
|
||||||
item.ParentPartID, item.name, item.item_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int RemoveInventoryItem(uint localID, LLUUID itemID)
|
|
||||||
{
|
{
|
||||||
SceneObjectPart part = GetChildPart(localID);
|
SceneObjectPart part = GetChildPart(localID);
|
||||||
if (part != null)
|
if (part != null)
|
||||||
{
|
{
|
||||||
int type = part.RemoveInventoryItem(itemID);
|
int type = part.RemoveInventoryItem(remoteClient, localID, itemID);
|
||||||
|
|
||||||
// It might seem somewhat crude to update the whole group for a single prim inventory change,
|
// It might seem somewhat crude to update the whole group for a single prim inventory change,
|
||||||
// but it's possible that other prim inventory changes will take place before the region
|
// but it's possible that other prim inventory changes will take place before the region
|
||||||
|
|
|
@ -56,6 +56,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
public event PrimCountTaintedDelegate OnPrimCountTainted;
|
public event PrimCountTaintedDelegate OnPrimCountTainted;
|
||||||
|
|
||||||
public bool HasChanged = false;
|
public bool HasChanged = false;
|
||||||
|
public bool TemporaryPrim = false; // rex
|
||||||
|
|
||||||
private LLVector3 lastPhysGroupPos;
|
private LLVector3 lastPhysGroupPos;
|
||||||
private LLQuaternion lastPhysGroupRot;
|
private LLQuaternion lastPhysGroupRot;
|
||||||
|
@ -375,9 +376,8 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
|
|
||||||
foreach (SceneObjectPart part in m_parts.Values)
|
foreach (SceneObjectPart part in m_parts.Values)
|
||||||
{
|
{
|
||||||
// Temporary commented to stop compiler warning
|
Vector3 partPosition =
|
||||||
//Vector3 partPosition =
|
new Vector3(part.AbsolutePosition.X, part.AbsolutePosition.Y, part.AbsolutePosition.Z);
|
||||||
// new Vector3(part.AbsolutePosition.X, part.AbsolutePosition.Y, part.AbsolutePosition.Z);
|
|
||||||
Quaternion parentrotation =
|
Quaternion parentrotation =
|
||||||
new Quaternion(GroupRotation.W, GroupRotation.X, GroupRotation.Y, GroupRotation.Z);
|
new Quaternion(GroupRotation.W, GroupRotation.X, GroupRotation.Y, GroupRotation.Z);
|
||||||
|
|
||||||
|
@ -446,6 +446,15 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Rex, new constructor
|
||||||
|
public SceneObjectGroup(Scene scene, ulong regionHandle, LLUUID ownerID, uint localID, LLVector3 pos,
|
||||||
|
LLQuaternion rot, PrimitiveBaseShape shape, bool vbTempPrim, string vPyClass)
|
||||||
|
: this(scene, regionHandle, ownerID, localID, pos, rot, shape)
|
||||||
|
{
|
||||||
|
TemporaryPrim = vbTempPrim;
|
||||||
|
m_rootPart.m_RexClassName = vPyClass;
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
public string ToXmlString()
|
public string ToXmlString()
|
||||||
|
@ -543,7 +552,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
new PhysicsVector(dupe.RootPart.Scale.X, dupe.RootPart.Scale.Y, dupe.RootPart.Scale.Z),
|
new PhysicsVector(dupe.RootPart.Scale.X, dupe.RootPart.Scale.Y, dupe.RootPart.Scale.Z),
|
||||||
new Quaternion(dupe.RootPart.RotationOffset.W, dupe.RootPart.RotationOffset.X,
|
new Quaternion(dupe.RootPart.RotationOffset.W, dupe.RootPart.RotationOffset.X,
|
||||||
dupe.RootPart.RotationOffset.Y, dupe.RootPart.RotationOffset.Z),
|
dupe.RootPart.RotationOffset.Y, dupe.RootPart.RotationOffset.Z),
|
||||||
dupe.RootPart.PhysActor.IsPhysical);
|
dupe.RootPart.PhysActor.IsPhysical, dupe.LocalId);
|
||||||
dupe.RootPart.DoPhysicsPropertyUpdate(dupe.RootPart.PhysActor.IsPhysical, true);
|
dupe.RootPart.DoPhysicsPropertyUpdate(dupe.RootPart.PhysActor.IsPhysical, true);
|
||||||
}
|
}
|
||||||
// Now we've made a copy that replaces this one, we need to
|
// Now we've made a copy that replaces this one, we need to
|
||||||
|
@ -678,6 +687,11 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public override void Update()
|
public override void Update()
|
||||||
{
|
{
|
||||||
|
if (DeleteMe) // rex, added
|
||||||
|
{
|
||||||
|
m_scene.DeleteSceneObjectGroup(this);
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (Util.GetDistanceTo(lastPhysGroupPos, AbsolutePosition) > 0.02)
|
if (Util.GetDistanceTo(lastPhysGroupPos, AbsolutePosition) > 0.02)
|
||||||
{
|
{
|
||||||
foreach (SceneObjectPart part in m_parts.Values)
|
foreach (SceneObjectPart part in m_parts.Values)
|
||||||
|
@ -828,8 +842,10 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public bool HasChildPrim(LLUUID primID)
|
public bool HasChildPrim(LLUUID primID)
|
||||||
{
|
{
|
||||||
|
SceneObjectPart childPart = null;
|
||||||
if (m_parts.ContainsKey(primID))
|
if (m_parts.ContainsKey(primID))
|
||||||
{
|
{
|
||||||
|
childPart = m_parts[primID];
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -969,7 +985,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
new PhysicsVector(linkPart.Scale.X, linkPart.Scale.Y, linkPart.Scale.Z),
|
new PhysicsVector(linkPart.Scale.X, linkPart.Scale.Y, linkPart.Scale.Z),
|
||||||
new Quaternion(linkPart.RotationOffset.W, linkPart.RotationOffset.X,
|
new Quaternion(linkPart.RotationOffset.W, linkPart.RotationOffset.X,
|
||||||
linkPart.RotationOffset.Y, linkPart.RotationOffset.Z),
|
linkPart.RotationOffset.Y, linkPart.RotationOffset.Z),
|
||||||
m_rootPart.PhysActor.IsPhysical);
|
m_rootPart.PhysActor.IsPhysical, linkPart.LocalID);
|
||||||
m_rootPart.DoPhysicsPropertyUpdate(m_rootPart.PhysActor.IsPhysical, true);
|
m_rootPart.DoPhysicsPropertyUpdate(m_rootPart.PhysActor.IsPhysical, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1206,7 +1222,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
new PhysicsVector(m_rootPart.Scale.X, m_rootPart.Scale.Y, m_rootPart.Scale.Z),
|
new PhysicsVector(m_rootPart.Scale.X, m_rootPart.Scale.Y, m_rootPart.Scale.Z),
|
||||||
new Quaternion(m_rootPart.RotationOffset.W, m_rootPart.RotationOffset.X,
|
new Quaternion(m_rootPart.RotationOffset.W, m_rootPart.RotationOffset.X,
|
||||||
m_rootPart.RotationOffset.Y, m_rootPart.RotationOffset.Z),
|
m_rootPart.RotationOffset.Y, m_rootPart.RotationOffset.Z),
|
||||||
m_rootPart.PhysActor.IsPhysical);
|
m_rootPart.PhysActor.IsPhysical, m_rootPart.LocalID);
|
||||||
bool UsePhysics = ((m_rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Physics) != 0);
|
bool UsePhysics = ((m_rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Physics) != 0);
|
||||||
m_rootPart.DoPhysicsPropertyUpdate(UsePhysics, true);
|
m_rootPart.DoPhysicsPropertyUpdate(UsePhysics, true);
|
||||||
|
|
||||||
|
@ -1461,6 +1477,12 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
/// <param name="datastore"></param>
|
/// <param name="datastore"></param>
|
||||||
public void ProcessBackup(IRegionDataStore datastore)
|
public void ProcessBackup(IRegionDataStore datastore)
|
||||||
{
|
{
|
||||||
|
// Rex, temporary prims not saved to database!
|
||||||
|
if (TemporaryPrim)
|
||||||
|
{
|
||||||
|
HasChanged = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (HasChanged)
|
if (HasChanged)
|
||||||
{
|
{
|
||||||
datastore.StoreObject(this, m_scene.RegionInfo.RegionID);
|
datastore.StoreObject(this, m_scene.RegionInfo.RegionID);
|
||||||
|
|
|
@ -146,25 +146,6 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Stop a script which is in this prim's inventory.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="itemId"></param>
|
|
||||||
public void StopScript(LLUUID itemId)
|
|
||||||
{
|
|
||||||
if (m_taskInventory.ContainsKey(itemId))
|
|
||||||
{
|
|
||||||
m_parentGroup.Scene.EventManager.TriggerRemoveScript(LocalID, itemId);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
MainLog.Instance.Error(
|
|
||||||
"PRIMINVENTORY",
|
|
||||||
"Couldn't stop script with ID {0} since it couldn't be found for prim {1}, {2}",
|
|
||||||
itemId, Name, UUID);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Add an item to this prim's inventory.
|
/// Add an item to this prim's inventory.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -193,61 +174,16 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
m_inventorySerial++;
|
m_inventorySerial++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Returns an existing inventory item. Returns the original, so any changes will be live.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="itemID"></param>
|
|
||||||
/// <returns>null if the item does not exist</returns>
|
|
||||||
public TaskInventoryItem GetInventoryItem(LLUUID itemID)
|
|
||||||
{
|
|
||||||
if (m_taskInventory.ContainsKey(itemID))
|
|
||||||
{
|
|
||||||
return m_taskInventory[itemID];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
MainLog.Instance.Error(
|
|
||||||
"PRIMINVENTORY",
|
|
||||||
"Tried to retrieve item ID {0} from prim {1}, {2} but the item does not exist in this inventory",
|
|
||||||
itemID, Name, UUID);
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Update an existing inventory item.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="item">The updated item. An item with the same id must already exist
|
|
||||||
/// in this prim's inventory.</param>
|
|
||||||
/// <returns>false if the item did not exist, true if the update occurred succesfully</returns>
|
|
||||||
public bool UpdateInventoryItem(TaskInventoryItem item)
|
|
||||||
{
|
|
||||||
if (m_taskInventory.ContainsKey(item.item_id))
|
|
||||||
{
|
|
||||||
m_taskInventory[item.item_id] = item;
|
|
||||||
m_inventorySerial++;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
MainLog.Instance.Error(
|
|
||||||
"PRIMINVENTORY",
|
|
||||||
"Tried to retrieve item ID {0} from prim {1}, {2} but the item does not exist in this inventory",
|
|
||||||
item.item_id, Name, UUID);
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Remove an item from this prim's inventory
|
/// Remove an item from this prim's inventory
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="remoteClient"></param>
|
||||||
|
/// <param name="localID"></param>
|
||||||
/// <param name="itemID"></param>
|
/// <param name="itemID"></param>
|
||||||
/// <returns>Numeric asset type of the item removed. Returns -1 if the item did not exist
|
/// <returns>Numeric asset type of the item removed.</returns>
|
||||||
/// in this prim's inventory.</returns>
|
public int RemoveInventoryItem(IClientAPI remoteClient, uint localID, LLUUID itemID)
|
||||||
public int RemoveInventoryItem(LLUUID itemID)
|
{
|
||||||
|
if (localID == LocalID)
|
||||||
{
|
{
|
||||||
if (m_taskInventory.ContainsKey(itemID))
|
if (m_taskInventory.ContainsKey(itemID))
|
||||||
{
|
{
|
||||||
|
@ -263,14 +199,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
MainLog.Instance.Error(
|
|
||||||
"PRIMINVENTORY",
|
|
||||||
"Tried to remove item ID {0} from prim {1}, {2} but the item does not exist in this inventory",
|
|
||||||
itemID, Name, UUID);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Text; // rex, StringBuilder needed
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Xml;
|
using System.Xml;
|
||||||
|
@ -93,6 +94,46 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private byte m_updateFlag;
|
private byte m_updateFlag;
|
||||||
|
|
||||||
|
// rex, extra parameters & their definitions
|
||||||
|
|
||||||
|
// reX extra block parameters in easily readable format
|
||||||
|
public string m_RexClassName = "";
|
||||||
|
public byte m_RexFlags = 0;
|
||||||
|
public byte m_RexCollisionType = 0;
|
||||||
|
public float m_RexDrawDistance = 0.0F;
|
||||||
|
public float m_RexLOD = 0.0F;
|
||||||
|
public LLUUID m_RexMeshUUID = LLUUID.Zero;
|
||||||
|
public LLUUID m_RexCollisionMeshUUID = LLUUID.Zero;
|
||||||
|
public List<LLUUID> m_RexMaterialUUID = new List<LLUUID>();
|
||||||
|
public byte m_RexFixedMaterial = 0;
|
||||||
|
public LLUUID m_RexParticleScriptUUID = LLUUID.Zero;
|
||||||
|
|
||||||
|
// reX extra parameter block defines
|
||||||
|
public const int PARAMS_REX = 0x0100;
|
||||||
|
|
||||||
|
// Bit values for flags
|
||||||
|
public const int REXFLAGS_ISMESH = 0x01;
|
||||||
|
public const int REXFLAGS_ISVISIBLE = 0x02;
|
||||||
|
public const int REXFLAGS_CASTSHADOWS = 0x04;
|
||||||
|
public const int REXFLAGS_SHOWTEXT = 0x08;
|
||||||
|
public const int REXFLAGS_SCALEMESH = 0x10;
|
||||||
|
public const int REXFLAGS_SOLIDALPHA = 0x20;
|
||||||
|
public const int REXFLAGS_ISBILLBOARD = 0x40;
|
||||||
|
public const int REXFLAGS_USEPARTICLESCRIPT = 0x80;
|
||||||
|
|
||||||
|
// Collision type enumeration (still unused :))
|
||||||
|
public const int REXCOLLISION_VOLUME = 0x01;
|
||||||
|
public const int REXCOLLISION_TRIMESH = 0x02;
|
||||||
|
|
||||||
|
// Attachment parameters
|
||||||
|
private ScenePresence m_attachPresence = null;
|
||||||
|
private byte m_attachPt;
|
||||||
|
private LLQuaternion m_attachRot;
|
||||||
|
private RegionInfo m_attachRegInfo;
|
||||||
|
private LLUUID m_attachAgentId;
|
||||||
|
|
||||||
|
// rexend
|
||||||
|
|
||||||
#region Properties
|
#region Properties
|
||||||
|
|
||||||
public LLUUID CreatorID;
|
public LLUUID CreatorID;
|
||||||
|
@ -362,6 +403,22 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
|
|
||||||
private string m_touchName = "";
|
private string m_touchName = "";
|
||||||
|
|
||||||
|
//rex (hack)
|
||||||
|
private LLUUID touchedBy = LLUUID.Zero;
|
||||||
|
|
||||||
|
//rex (hack)
|
||||||
|
public LLUUID TouchedBy
|
||||||
|
{
|
||||||
|
set
|
||||||
|
{
|
||||||
|
touchedBy = value;
|
||||||
|
}
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return touchedBy;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public string TouchName
|
public string TouchName
|
||||||
{
|
{
|
||||||
get { return m_touchName; }
|
get { return m_touchName; }
|
||||||
|
@ -574,7 +631,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
AbsolutePosition.Z),
|
AbsolutePosition.Z),
|
||||||
new PhysicsVector(Scale.X, Scale.Y, Scale.Z),
|
new PhysicsVector(Scale.X, Scale.Y, Scale.Z),
|
||||||
new Quaternion(RotationOffset.W, RotationOffset.X,
|
new Quaternion(RotationOffset.W, RotationOffset.X,
|
||||||
RotationOffset.Y, RotationOffset.Z), usePhysics);
|
RotationOffset.Y, RotationOffset.Z), usePhysics,LocalID);
|
||||||
}
|
}
|
||||||
|
|
||||||
DoPhysicsPropertyUpdate(usePhysics, true);
|
DoPhysicsPropertyUpdate(usePhysics, true);
|
||||||
|
@ -663,6 +720,8 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
EveryoneMask &= ~(uint) LLObject.ObjectFlags.CastShadows;
|
EveryoneMask &= ~(uint) LLObject.ObjectFlags.CastShadows;
|
||||||
EveryoneMask &= ~(uint) LLObject.ObjectFlags.InventoryEmpty;
|
EveryoneMask &= ~(uint) LLObject.ObjectFlags.InventoryEmpty;
|
||||||
EveryoneMask &= ~(uint) LLObject.ObjectFlags.CreateSelected;
|
EveryoneMask &= ~(uint) LLObject.ObjectFlags.CreateSelected;
|
||||||
|
EveryoneMask &= ~(uint)LLObject.ObjectFlags.ObjectYouOfficer;
|
||||||
|
EveryoneMask &= ~(uint)LLObject.ObjectFlags.ObjectModify;
|
||||||
|
|
||||||
|
|
||||||
// These are some flags that ObjectFlags (m_flags) should never have
|
// These are some flags that ObjectFlags (m_flags) should never have
|
||||||
|
@ -1051,11 +1110,17 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
bool wasUsingPhysics = ((ObjectFlags & (uint) LLObject.ObjectFlags.Physics) != 0);
|
bool wasUsingPhysics = ((ObjectFlags & (uint) LLObject.ObjectFlags.Physics) != 0);
|
||||||
//bool IsLocked = false;
|
//bool IsLocked = false;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
//rex
|
||||||
|
LLUUID AgentID = LLUUID.Zero, SessionID = LLUUID.Zero;
|
||||||
|
uint ObjectLocalID;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
i += 46;
|
//rex
|
||||||
|
i += 10;
|
||||||
|
AgentID = new LLUUID(data, i); i += 16;
|
||||||
|
SessionID = new LLUUID(data, i); i += 16;
|
||||||
|
ObjectLocalID = (uint)(data[i++] + (data[i++] << 8) + (data[i++] << 16) + (data[i++] << 24));
|
||||||
//IsLocked = (data[i++] != 0) ? true : false;
|
//IsLocked = (data[i++] != 0) ? true : false;
|
||||||
usePhysics = ((data[i++] != 0) && m_parentGroup.Scene.m_physicalPrim) ? true : false;
|
usePhysics = ((data[i++] != 0) && m_parentGroup.Scene.m_physicalPrim) ? true : false;
|
||||||
//System.Console.WriteLine("U" + packet.ToBytes().Length.ToString());
|
//System.Console.WriteLine("U" + packet.ToBytes().Length.ToString());
|
||||||
|
@ -1069,6 +1134,17 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
//Silently ignore it - TODO: FIXME Quick
|
//Silently ignore it - TODO: FIXME Quick
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#region rex added flags
|
||||||
|
if (AgentID == this.OwnerID)
|
||||||
|
{
|
||||||
|
AddFlag(LLObject.ObjectFlags.ObjectYouOwner);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
RemFlag(LLObject.ObjectFlags.ObjectYouOwner);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
if (usePhysics)
|
if (usePhysics)
|
||||||
{
|
{
|
||||||
AddFlag(LLObject.ObjectFlags.Physics);
|
AddFlag(LLObject.ObjectFlags.Physics);
|
||||||
|
@ -1109,7 +1185,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
AbsolutePosition.Z),
|
AbsolutePosition.Z),
|
||||||
new PhysicsVector(Scale.X, Scale.Y, Scale.Z),
|
new PhysicsVector(Scale.X, Scale.Y, Scale.Z),
|
||||||
new Quaternion(RotationOffset.W, RotationOffset.X,
|
new Quaternion(RotationOffset.W, RotationOffset.X,
|
||||||
RotationOffset.Y, RotationOffset.Z), usePhysics);
|
RotationOffset.Y, RotationOffset.Z), usePhysics, LocalID);
|
||||||
DoPhysicsPropertyUpdate(usePhysics, true);
|
DoPhysicsPropertyUpdate(usePhysics, true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1178,22 +1254,301 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
|
|
||||||
public void UpdateExtraParam(ushort type, bool inUse, byte[] data)
|
public void UpdateExtraParam(ushort type, bool inUse, byte[] data)
|
||||||
{
|
{
|
||||||
m_shape.ExtraParams = new byte[data.Length + 7];
|
// rex, function fixed for handling multiple parameter blocks and disabling them
|
||||||
int i = 0;
|
|
||||||
uint length = (uint) data.Length;
|
|
||||||
m_shape.ExtraParams[i++] = 1;
|
|
||||||
m_shape.ExtraParams[i++] = (byte) (type%256);
|
|
||||||
m_shape.ExtraParams[i++] = (byte) ((type >> 8)%256);
|
|
||||||
|
|
||||||
m_shape.ExtraParams[i++] = (byte) (length%256);
|
//m_shape.ExtraParams = new byte[data.Length + 7];
|
||||||
m_shape.ExtraParams[i++] = (byte) ((length >> 8)%256);
|
//int i = 0;
|
||||||
m_shape.ExtraParams[i++] = (byte) ((length >> 16)%256);
|
//uint length = (uint) data.Length;
|
||||||
m_shape.ExtraParams[i++] = (byte) ((length >> 24)%256);
|
//m_shape.ExtraParams[i++] = 1;
|
||||||
Array.Copy(data, 0, m_shape.ExtraParams, i, data.Length);
|
//m_shape.ExtraParams[i++] = (byte) (type%256);
|
||||||
|
//m_shape.ExtraParams[i++] = (byte) ((type >> 8)%256);
|
||||||
|
|
||||||
|
//m_shape.ExtraParams[i++] = (byte) (length%256);
|
||||||
|
//m_shape.ExtraParams[i++] = (byte) ((length >> 8)%256);
|
||||||
|
//m_shape.ExtraParams[i++] = (byte) ((length >> 16)%256);
|
||||||
|
//m_shape.ExtraParams[i++] = (byte) ((length >> 24)%256);
|
||||||
|
//Array.Copy(data, 0, m_shape.ExtraParams, i, data.Length);
|
||||||
|
|
||||||
|
// Amount of param blocks in new & old extra params
|
||||||
|
int numOld = 0;
|
||||||
|
int numNew = 0;
|
||||||
|
|
||||||
|
// If old param block exists, take its length & amount of param blocks in it
|
||||||
|
int totalSizeOld = 0;
|
||||||
|
int idxOld = 0;
|
||||||
|
if (m_shape.ExtraParams != null)
|
||||||
|
{
|
||||||
|
numOld = m_shape.ExtraParams[idxOld++];
|
||||||
|
totalSizeOld = m_shape.ExtraParams.Length;
|
||||||
|
}
|
||||||
|
|
||||||
|
// New extra params: maximum size = old extra params + size of new data + possible new param block header + num of blocks
|
||||||
|
byte[] newExtraParams = new byte[totalSizeOld + data.Length + 6 + 1];
|
||||||
|
|
||||||
|
int idxNew = 1; // Don't know the amount of new param blocks yet, fill it later
|
||||||
|
bool isNewBlock = true;
|
||||||
|
|
||||||
|
// Go through each of the old params, and see if this new update disables or changes it
|
||||||
|
for (int i = 0; i < numOld; i++)
|
||||||
|
{
|
||||||
|
int typeOld = m_shape.ExtraParams[idxOld++] | (m_shape.ExtraParams[idxOld++] << 8);
|
||||||
|
int lengthOld = m_shape.ExtraParams[idxOld++] | (m_shape.ExtraParams[idxOld++] << 8) |
|
||||||
|
(m_shape.ExtraParams[idxOld++] << 16) | (m_shape.ExtraParams[idxOld++] << 24);
|
||||||
|
|
||||||
|
// Not changed, copy verbatim
|
||||||
|
if (typeOld != type)
|
||||||
|
{
|
||||||
|
newExtraParams[idxNew++] = (byte)(typeOld % 256);
|
||||||
|
newExtraParams[idxNew++] = (byte)((typeOld >> 8) % 256);
|
||||||
|
newExtraParams[idxNew++] = (byte)(lengthOld % 256);
|
||||||
|
newExtraParams[idxNew++] = (byte)((lengthOld >> 8) % 256);
|
||||||
|
newExtraParams[idxNew++] = (byte)((lengthOld >> 16) % 256);
|
||||||
|
newExtraParams[idxNew++] = (byte)((lengthOld >> 24) % 256);
|
||||||
|
Array.Copy(m_shape.ExtraParams, idxOld, newExtraParams, idxNew, lengthOld);
|
||||||
|
|
||||||
|
idxNew += lengthOld;
|
||||||
|
numNew++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
isNewBlock = false;
|
||||||
|
|
||||||
|
// Old parameter updated, check if still in use, or if should remove
|
||||||
|
if (inUse)
|
||||||
|
{
|
||||||
|
newExtraParams[idxNew++] = (byte)(type % 256);
|
||||||
|
newExtraParams[idxNew++] = (byte)((type >> 8) % 256);
|
||||||
|
newExtraParams[idxNew++] = (byte)(data.Length % 256);
|
||||||
|
newExtraParams[idxNew++] = (byte)((data.Length >> 8) % 256);
|
||||||
|
newExtraParams[idxNew++] = (byte)((data.Length >> 16) % 256);
|
||||||
|
newExtraParams[idxNew++] = (byte)((data.Length >> 24) % 256);
|
||||||
|
Array.Copy(data, 0, newExtraParams, idxNew, data.Length);
|
||||||
|
|
||||||
|
idxNew += data.Length;
|
||||||
|
numNew++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
idxOld += lengthOld;
|
||||||
|
}
|
||||||
|
// If type was not listed, create new block
|
||||||
|
if ((isNewBlock) && (inUse))
|
||||||
|
{
|
||||||
|
newExtraParams[idxNew++] = (byte)(type % 256);
|
||||||
|
newExtraParams[idxNew++] = (byte)((type >> 8) % 256);
|
||||||
|
newExtraParams[idxNew++] = (byte)(data.Length % 256);
|
||||||
|
newExtraParams[idxNew++] = (byte)((data.Length >> 8) % 256);
|
||||||
|
newExtraParams[idxNew++] = (byte)((data.Length >> 16) % 256);
|
||||||
|
newExtraParams[idxNew++] = (byte)((data.Length >> 24) % 256);
|
||||||
|
Array.Copy(data, 0, newExtraParams, idxNew, data.Length);
|
||||||
|
|
||||||
|
idxNew += data.Length;
|
||||||
|
numNew++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Now we know final size and number of param blocks
|
||||||
|
newExtraParams[0] = (byte)numNew;
|
||||||
|
m_shape.ExtraParams = new byte[idxNew];
|
||||||
|
Array.Copy(newExtraParams, m_shape.ExtraParams, idxNew);
|
||||||
|
|
||||||
|
string OldPythonClass = m_RexClassName;
|
||||||
|
LLUUID OldColMesh = m_RexCollisionMeshUUID;
|
||||||
|
bool OldMeshScaling = ((m_RexFlags & REXFLAGS_SCALEMESH) != 0);
|
||||||
|
|
||||||
|
GetRexParameters();
|
||||||
|
|
||||||
|
if (m_RexClassName != OldPythonClass)
|
||||||
|
m_parentGroup.Scene.EventManager.TriggerOnChangePythonClass(LocalID);
|
||||||
|
|
||||||
|
if (GlobalSettings.Instance.m_3d_collision_models)
|
||||||
|
{
|
||||||
|
if (m_RexCollisionMeshUUID != OldColMesh && PhysActor != null)
|
||||||
|
{
|
||||||
|
if (m_RexCollisionMeshUUID != LLUUID.Zero)
|
||||||
|
RexUpdateCollisionMesh();
|
||||||
|
else
|
||||||
|
PhysActor.SetCollisionMesh(null, "", false);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool NewMeshScaling = ((m_RexFlags & REXFLAGS_SCALEMESH) != 0);
|
||||||
|
if (NewMeshScaling != OldMeshScaling && PhysActor != null)
|
||||||
|
{
|
||||||
|
PhysActor.SetBoundsScaling(NewMeshScaling);
|
||||||
|
m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// rexend
|
||||||
|
|
||||||
ScheduleFullUpdate();
|
ScheduleFullUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// rex, new function, compiles / sends rex parameters after serverside modification
|
||||||
|
public void UpdateRexParameters()
|
||||||
|
{
|
||||||
|
// Compile reX member variables into an extraparam-block
|
||||||
|
int size = m_RexClassName.Length + 1 // Name + endzero
|
||||||
|
+ 1 + 1 + 4 + 4 // Flags, collisiontype, drawdistance, lod
|
||||||
|
+ 16 + 16 // Mesh UUID & collisionmesh UUID
|
||||||
|
+ 2 + m_RexMaterialUUID.Count * 16 // Material count and UUID's
|
||||||
|
+ 1 // Fixed material
|
||||||
|
+ 16; // Particle script UUID
|
||||||
|
|
||||||
|
byte[] buffer = new byte[size];
|
||||||
|
int idx = 0;
|
||||||
|
|
||||||
|
for (int i = 0; i < m_RexClassName.Length; i++)
|
||||||
|
{
|
||||||
|
buffer[idx++] = (byte)m_RexClassName[i];
|
||||||
|
}
|
||||||
|
buffer[idx++] = 0;
|
||||||
|
|
||||||
|
buffer[idx++] = m_RexFlags;
|
||||||
|
|
||||||
|
buffer[idx++] = m_RexCollisionType;
|
||||||
|
|
||||||
|
System.BitConverter.GetBytes(m_RexDrawDistance).CopyTo(buffer, idx);
|
||||||
|
idx += 4;
|
||||||
|
|
||||||
|
System.BitConverter.GetBytes(m_RexLOD).CopyTo(buffer, idx);
|
||||||
|
idx += 4;
|
||||||
|
|
||||||
|
m_RexMeshUUID.GetBytes().CopyTo(buffer, idx);
|
||||||
|
idx += 16;
|
||||||
|
|
||||||
|
m_RexCollisionMeshUUID.GetBytes().CopyTo(buffer, idx);
|
||||||
|
idx += 16;
|
||||||
|
|
||||||
|
System.BitConverter.GetBytes((short)m_RexMaterialUUID.Count).CopyTo(buffer, idx);
|
||||||
|
idx += 2;
|
||||||
|
for (int i = 0; i < m_RexMaterialUUID.Count; i++)
|
||||||
|
{
|
||||||
|
m_RexMaterialUUID[i].GetBytes().CopyTo(buffer, idx);
|
||||||
|
idx += 16;
|
||||||
|
}
|
||||||
|
|
||||||
|
buffer[idx++] = m_RexFixedMaterial;
|
||||||
|
|
||||||
|
m_RexParticleScriptUUID.GetBytes().CopyTo(buffer, idx);
|
||||||
|
idx += 16;
|
||||||
|
|
||||||
|
UpdateExtraParam(PARAMS_REX, true, buffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
// rex, new function, extract reX parameters from the parameter block
|
||||||
|
public void GetRexParameters()
|
||||||
|
{
|
||||||
|
if (m_shape.ExtraParams == null) return;
|
||||||
|
|
||||||
|
int idx = 0;
|
||||||
|
int numParams = m_shape.ExtraParams[idx++];
|
||||||
|
|
||||||
|
for (int i = 0; i < numParams; i++)
|
||||||
|
{
|
||||||
|
// Is this the reX parameter block?
|
||||||
|
int type = m_shape.ExtraParams[idx++] | (m_shape.ExtraParams[idx++] << 8);
|
||||||
|
int length = m_shape.ExtraParams[idx++] | (m_shape.ExtraParams[idx++] << 8) |
|
||||||
|
(m_shape.ExtraParams[idx++] << 16) | (m_shape.ExtraParams[idx++] << 24);
|
||||||
|
int start = idx;
|
||||||
|
|
||||||
|
if (type == PARAMS_REX)
|
||||||
|
{
|
||||||
|
// Class name
|
||||||
|
StringBuilder buffer = new StringBuilder();
|
||||||
|
while ((idx < (length + start)) && (m_shape.ExtraParams[idx] != 0))
|
||||||
|
{
|
||||||
|
char c = (char)m_shape.ExtraParams[idx++];
|
||||||
|
buffer.Append(c);
|
||||||
|
}
|
||||||
|
m_RexClassName = buffer.ToString();
|
||||||
|
idx++;
|
||||||
|
|
||||||
|
// Rex flags
|
||||||
|
if (idx < (length + start))
|
||||||
|
{
|
||||||
|
m_RexFlags = m_shape.ExtraParams[idx++];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Collision type
|
||||||
|
if (idx < (length + start))
|
||||||
|
{
|
||||||
|
m_RexCollisionType = m_shape.ExtraParams[idx++];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Draw distance
|
||||||
|
if (idx < (length + start - 3))
|
||||||
|
{
|
||||||
|
m_RexDrawDistance = System.BitConverter.ToSingle(m_shape.ExtraParams, idx);
|
||||||
|
idx += 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Mesh LOD
|
||||||
|
if (idx < (length + start - 3))
|
||||||
|
{
|
||||||
|
m_RexLOD = System.BitConverter.ToSingle(m_shape.ExtraParams, idx);
|
||||||
|
idx += 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Mesh UUID
|
||||||
|
if (idx < (length + start - 15))
|
||||||
|
{
|
||||||
|
m_RexMeshUUID = new LLUUID(m_shape.ExtraParams, idx);
|
||||||
|
idx += 16;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Collision mesh UUID
|
||||||
|
if (idx < (length + start - 15))
|
||||||
|
{
|
||||||
|
m_RexCollisionMeshUUID = new LLUUID(m_shape.ExtraParams, idx);
|
||||||
|
idx += 16;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Number of materials
|
||||||
|
if (idx < (length + start - 1))
|
||||||
|
{
|
||||||
|
short rexMaterials = System.BitConverter.ToInt16(m_shape.ExtraParams, idx);
|
||||||
|
idx += 2;
|
||||||
|
m_RexMaterialUUID = new List<LLUUID>();
|
||||||
|
|
||||||
|
for (short j = 0; j < rexMaterials; j++)
|
||||||
|
{
|
||||||
|
if (idx < (length + start - 15))
|
||||||
|
{
|
||||||
|
m_RexMaterialUUID.Add(new LLUUID(m_shape.ExtraParams, idx));
|
||||||
|
idx += 16;
|
||||||
|
}
|
||||||
|
else break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Fixed material
|
||||||
|
if (idx < (length + start))
|
||||||
|
{
|
||||||
|
m_RexFixedMaterial = m_shape.ExtraParams[idx++];
|
||||||
|
}
|
||||||
|
// Particle script UUID
|
||||||
|
if (idx < (length + start - 15))
|
||||||
|
{
|
||||||
|
m_RexParticleScriptUUID = new LLUUID(m_shape.ExtraParams, idx);
|
||||||
|
idx += 16;
|
||||||
|
}
|
||||||
|
|
||||||
|
//System.Console.WriteLine("Rex parameters of an object updated");
|
||||||
|
//System.Console.WriteLine("Rex class name: " + m_RexClassName);
|
||||||
|
//System.Console.WriteLine("Rex flags: " + (short)m_RexFlags);
|
||||||
|
//System.Console.WriteLine("Rex collision type: " + (short)m_RexCollisionType);
|
||||||
|
//System.Console.WriteLine("Rex draw distance: " + m_RexDrawDistance);
|
||||||
|
//System.Console.WriteLine("Rex LOD: " + m_RexLOD);
|
||||||
|
//System.Console.WriteLine("Rex mesh UUID: " + m_RexMeshUUID);
|
||||||
|
//System.Console.WriteLine("Rex collisionmesh UUID: " + m_RexCollisionMeshUUID);
|
||||||
|
//System.Console.WriteLine("Rex material count: " + m_RexMaterialUUID.Count);
|
||||||
|
//for (int j = 0; j < m_RexMaterialUUID.Count; j++)
|
||||||
|
//{
|
||||||
|
// System.Console.WriteLine("Rex material UUID " + j + ": " + m_RexMaterialUUID[j]);
|
||||||
|
//}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else idx += length;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Physics
|
#region Physics
|
||||||
|
@ -1210,6 +1565,71 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// rex, added
|
||||||
|
public void SetMass(float vValue)
|
||||||
|
{
|
||||||
|
if (PhysActor != null)
|
||||||
|
{
|
||||||
|
// PhysActor.Mass = vValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// rex, added
|
||||||
|
public bool GetUsePrimVolumeCollision()
|
||||||
|
{
|
||||||
|
if (PhysActor != null)
|
||||||
|
return (PhysActor.PhysicsActorType == 4);
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// rex, added
|
||||||
|
public void SetUsePrimVolumeCollision(bool vUseVolumeCollision)
|
||||||
|
{
|
||||||
|
if (PhysActor != null)
|
||||||
|
{
|
||||||
|
if (vUseVolumeCollision)
|
||||||
|
{
|
||||||
|
if (PhysActor.PhysicsActorType != 4)
|
||||||
|
PhysActor.OnCollisionUpdate += PhysicsCollisionUpdate;
|
||||||
|
PhysActor.PhysicsActorType = 4;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (PhysActor.PhysicsActorType == 4)
|
||||||
|
PhysActor.OnCollisionUpdate -= PhysicsCollisionUpdate;
|
||||||
|
|
||||||
|
PhysActor.PhysicsActorType = 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// rex, added
|
||||||
|
private void PhysicsCollisionUpdate(EventArgs e)
|
||||||
|
{
|
||||||
|
if (PhysActor != null && PhysActor.PhysicsActorType == 4)
|
||||||
|
m_parentGroup.Scene.EventManager.TriggerOnPrimVolumeCollision(LocalID, (e as CollisionEventUpdate).m_LocalID);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// rex, added
|
||||||
|
public void RexUpdateCollisionMesh()
|
||||||
|
{
|
||||||
|
if (!GlobalSettings.Instance.m_3d_collision_models)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (m_RexCollisionMeshUUID != LLUUID.Zero && PhysActor != null)
|
||||||
|
{
|
||||||
|
bool ScaleMesh = ((m_RexFlags & REXFLAGS_SCALEMESH) != 0);
|
||||||
|
AssetBase tempmodel = m_parentGroup.Scene.AssetCache.FetchAsset(m_RexCollisionMeshUUID);
|
||||||
|
if (tempmodel != null)
|
||||||
|
PhysActor.SetCollisionMesh(tempmodel.Data, tempmodel.Name, ScaleMesh);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public LLVector3 GetGeometricCenter()
|
public LLVector3 GetGeometricCenter()
|
||||||
{
|
{
|
||||||
if (PhysActor != null)
|
if (PhysActor != null)
|
||||||
|
@ -1276,6 +1696,25 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
|
|
||||||
#region Position
|
#region Position
|
||||||
|
|
||||||
|
public void AttachToAvatar(LLUUID agentId, ScenePresence presence, byte attachPt, LLQuaternion rotation, RegionInfo regionInfo)
|
||||||
|
{
|
||||||
|
m_attachAgentId = agentId;
|
||||||
|
m_attachPresence = presence;
|
||||||
|
m_attachPt = attachPt;
|
||||||
|
m_attachRot = rotation;
|
||||||
|
m_attachRegInfo = regionInfo;
|
||||||
|
|
||||||
|
RotationOffset = new LLQuaternion(0, 0, 0, 1);
|
||||||
|
|
||||||
|
ScheduleFullUpdate();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Detach()
|
||||||
|
{
|
||||||
|
m_attachPresence = null;
|
||||||
|
ScheduleFullUpdate();
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -1414,6 +1853,137 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
SendFullUpdateToClient(remoteClient, lPos, clientflags);
|
SendFullUpdateToClient(remoteClient, lPos, clientflags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SendAttachedUpdateToClient(IClientAPI remoteClient, LLVector3 lPos, uint clientFlags)
|
||||||
|
{
|
||||||
|
MainLog.Instance.Verbose("OBJECTPART", "Sending as attached object to " + remoteClient.FirstName + " " + remoteClient.LastName);
|
||||||
|
ObjectUpdatePacket objupdate = new ObjectUpdatePacket();
|
||||||
|
objupdate.RegionData.RegionHandle = m_attachRegInfo.RegionHandle;
|
||||||
|
objupdate.RegionData.TimeDilation = 64096;
|
||||||
|
objupdate.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[2];
|
||||||
|
|
||||||
|
// avatar stuff - horrible group copypaste
|
||||||
|
objupdate.ObjectData[0] = new ObjectUpdatePacket.ObjectDataBlock();
|
||||||
|
objupdate.ObjectData[0].PSBlock = new byte[0];
|
||||||
|
objupdate.ObjectData[0].ExtraParams = new byte[1];
|
||||||
|
objupdate.ObjectData[0].MediaURL = new byte[0];
|
||||||
|
objupdate.ObjectData[0].NameValue = new byte[0];
|
||||||
|
objupdate.ObjectData[0].Text = new byte[0];
|
||||||
|
objupdate.ObjectData[0].TextColor = new byte[4];
|
||||||
|
objupdate.ObjectData[0].JointAxisOrAnchor = new LLVector3(0, 0, 0);
|
||||||
|
objupdate.ObjectData[0].JointPivot = new LLVector3(0, 0, 0);
|
||||||
|
objupdate.ObjectData[0].Material = 4;
|
||||||
|
objupdate.ObjectData[0].TextureAnim = new byte[0];
|
||||||
|
objupdate.ObjectData[0].Sound = LLUUID.Zero;
|
||||||
|
|
||||||
|
objupdate.ObjectData[0].State = 0;
|
||||||
|
objupdate.ObjectData[0].Data = new byte[0];
|
||||||
|
|
||||||
|
objupdate.ObjectData[0].ObjectData = new byte[76];
|
||||||
|
objupdate.ObjectData[0].ObjectData[15] = 128;
|
||||||
|
objupdate.ObjectData[0].ObjectData[16] = 63;
|
||||||
|
objupdate.ObjectData[0].ObjectData[56] = 128;
|
||||||
|
objupdate.ObjectData[0].ObjectData[61] = 102;
|
||||||
|
objupdate.ObjectData[0].ObjectData[62] = 40;
|
||||||
|
objupdate.ObjectData[0].ObjectData[63] = 61;
|
||||||
|
objupdate.ObjectData[0].ObjectData[64] = 189;
|
||||||
|
|
||||||
|
|
||||||
|
objupdate.ObjectData[0].UpdateFlags = 61 + (9 << 8) + (130 << 16) + (16 << 24);
|
||||||
|
objupdate.ObjectData[0].PathCurve = 16;
|
||||||
|
objupdate.ObjectData[0].ProfileCurve = 1;
|
||||||
|
objupdate.ObjectData[0].PathScaleX = 100;
|
||||||
|
objupdate.ObjectData[0].PathScaleY = 100;
|
||||||
|
objupdate.ObjectData[0].ParentID = 0;
|
||||||
|
objupdate.ObjectData[0].OwnerID = LLUUID.Zero;
|
||||||
|
objupdate.ObjectData[0].Scale = new LLVector3(1, 1, 1);
|
||||||
|
objupdate.ObjectData[0].PCode = 47;
|
||||||
|
objupdate.ObjectData[0].TextureEntry = ScenePresence.DefaultTexture;
|
||||||
|
|
||||||
|
objupdate.ObjectData[0].ID = m_attachPresence.LocalId;
|
||||||
|
objupdate.ObjectData[0].FullID = m_attachAgentId;
|
||||||
|
objupdate.ObjectData[0].ParentID = 0;
|
||||||
|
objupdate.ObjectData[0].NameValue =
|
||||||
|
Helpers.StringToField("FirstName STRING RW SV " + m_attachPresence.Firstname + "\nLastName STRING RW SV " + m_attachPresence.Lastname);
|
||||||
|
LLVector3 pos2 = m_attachPresence.AbsolutePosition;
|
||||||
|
// 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);
|
||||||
|
|
||||||
|
|
||||||
|
// primitive part
|
||||||
|
objupdate.ObjectData[1] = new ObjectUpdatePacket.ObjectDataBlock();
|
||||||
|
// SetDefaultPrimPacketValues
|
||||||
|
objupdate.ObjectData[1].PSBlock = new byte[0];
|
||||||
|
objupdate.ObjectData[1].ExtraParams = new byte[1];
|
||||||
|
objupdate.ObjectData[1].MediaURL = new byte[0];
|
||||||
|
objupdate.ObjectData[1].NameValue = new byte[0];
|
||||||
|
objupdate.ObjectData[1].Text = new byte[0];
|
||||||
|
objupdate.ObjectData[1].TextColor = new byte[4];
|
||||||
|
objupdate.ObjectData[1].JointAxisOrAnchor = new LLVector3(0, 0, 0);
|
||||||
|
objupdate.ObjectData[1].JointPivot = new LLVector3(0, 0, 0);
|
||||||
|
objupdate.ObjectData[1].Material = 3;
|
||||||
|
objupdate.ObjectData[1].TextureAnim = new byte[0];
|
||||||
|
objupdate.ObjectData[1].Sound = LLUUID.Zero;
|
||||||
|
objupdate.ObjectData[1].State = 0;
|
||||||
|
objupdate.ObjectData[1].Data = new byte[0];
|
||||||
|
|
||||||
|
objupdate.ObjectData[1].ObjectData = new byte[60];
|
||||||
|
objupdate.ObjectData[1].ObjectData[46] = 128;
|
||||||
|
objupdate.ObjectData[1].ObjectData[47] = 63;
|
||||||
|
|
||||||
|
// SetPrimPacketShapeData
|
||||||
|
PrimitiveBaseShape primData = Shape;
|
||||||
|
|
||||||
|
objupdate.ObjectData[1].TextureEntry = primData.TextureEntry;
|
||||||
|
objupdate.ObjectData[1].PCode = primData.PCode;
|
||||||
|
objupdate.ObjectData[1].State = (byte)(((byte)m_attachPt) << 4);
|
||||||
|
objupdate.ObjectData[1].PathBegin = primData.PathBegin;
|
||||||
|
objupdate.ObjectData[1].PathEnd = primData.PathEnd;
|
||||||
|
objupdate.ObjectData[1].PathScaleX = primData.PathScaleX;
|
||||||
|
objupdate.ObjectData[1].PathScaleY = primData.PathScaleY;
|
||||||
|
objupdate.ObjectData[1].PathShearX = primData.PathShearX;
|
||||||
|
objupdate.ObjectData[1].PathShearY = primData.PathShearY;
|
||||||
|
objupdate.ObjectData[1].PathSkew = primData.PathSkew;
|
||||||
|
objupdate.ObjectData[1].ProfileBegin = primData.ProfileBegin;
|
||||||
|
objupdate.ObjectData[1].ProfileEnd = primData.ProfileEnd;
|
||||||
|
objupdate.ObjectData[1].Scale = primData.Scale;
|
||||||
|
objupdate.ObjectData[1].PathCurve = primData.PathCurve;
|
||||||
|
objupdate.ObjectData[1].ProfileCurve = primData.ProfileCurve;
|
||||||
|
objupdate.ObjectData[1].ProfileHollow = primData.ProfileHollow;
|
||||||
|
objupdate.ObjectData[1].PathRadiusOffset = primData.PathRadiusOffset;
|
||||||
|
objupdate.ObjectData[1].PathRevolutions = primData.PathRevolutions;
|
||||||
|
objupdate.ObjectData[1].PathTaperX = primData.PathTaperX;
|
||||||
|
objupdate.ObjectData[1].PathTaperY = primData.PathTaperY;
|
||||||
|
objupdate.ObjectData[1].PathTwist = primData.PathTwist;
|
||||||
|
objupdate.ObjectData[1].PathTwistBegin = primData.PathTwistBegin;
|
||||||
|
objupdate.ObjectData[1].ExtraParams = primData.ExtraParams;
|
||||||
|
|
||||||
|
objupdate.ObjectData[1].UpdateFlags = 276957500; // flags; // ??
|
||||||
|
objupdate.ObjectData[1].ID = LocalID;
|
||||||
|
objupdate.ObjectData[1].FullID = UUID;
|
||||||
|
objupdate.ObjectData[1].OwnerID = OwnerID;
|
||||||
|
objupdate.ObjectData[1].Text = Helpers.StringToField(Text);
|
||||||
|
objupdate.ObjectData[1].TextColor[0] = 255;
|
||||||
|
objupdate.ObjectData[1].TextColor[1] = 255;
|
||||||
|
objupdate.ObjectData[1].TextColor[2] = 255;
|
||||||
|
objupdate.ObjectData[1].TextColor[3] = 128;
|
||||||
|
objupdate.ObjectData[1].ParentID = objupdate.ObjectData[0].ID;
|
||||||
|
//objupdate.ObjectData[1].PSBlock = particleSystem;
|
||||||
|
//objupdate.ObjectData[1].ClickAction = clickAction;
|
||||||
|
objupdate.ObjectData[1].Radius = 20;
|
||||||
|
objupdate.ObjectData[1].NameValue =
|
||||||
|
Helpers.StringToField("AttachItemID STRING RW SV " + UUID);
|
||||||
|
LLVector3 pos = new LLVector3((float)0.0, (float)0.0, (float)0.0);
|
||||||
|
|
||||||
|
pb = pos.GetBytes();
|
||||||
|
Array.Copy(pb, 0, objupdate.ObjectData[1].ObjectData, 0, pb.Length);
|
||||||
|
|
||||||
|
byte[] brot = m_attachRot.GetBytes();
|
||||||
|
Array.Copy(brot, 0, objupdate.ObjectData[1].ObjectData, 36, brot.Length);
|
||||||
|
|
||||||
|
remoteClient.OutPacket(objupdate, ThrottleOutPacketType.Task);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -1421,6 +1991,12 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
/// <param name="lPos"></param>
|
/// <param name="lPos"></param>
|
||||||
public void SendFullUpdateToClient(IClientAPI remoteClient, LLVector3 lPos, uint clientFlags)
|
public void SendFullUpdateToClient(IClientAPI remoteClient, LLVector3 lPos, uint clientFlags)
|
||||||
{
|
{
|
||||||
|
if (m_attachPresence != null)
|
||||||
|
{
|
||||||
|
SendAttachedUpdateToClient(remoteClient, lPos, clientFlags);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
LLQuaternion lRot;
|
LLQuaternion lRot;
|
||||||
lRot = RotationOffset;
|
lRot = RotationOffset;
|
||||||
clientFlags &= ~(uint) LLObject.ObjectFlags.CreateSelected;
|
clientFlags &= ~(uint) LLObject.ObjectFlags.CreateSelected;
|
||||||
|
|
|
@ -39,13 +39,15 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
{
|
{
|
||||||
public class ScenePresence : EntityBase
|
public class ScenePresence : EntityBase
|
||||||
{
|
{
|
||||||
public static AvatarAnimations Animations;
|
public static AvatarAnimations Animations = null;
|
||||||
public static byte[] DefaultTexture;
|
public static byte[] DefaultTexture;
|
||||||
public LLUUID currentParcelUUID = LLUUID.Zero;
|
public LLUUID currentParcelUUID = LLUUID.Zero;
|
||||||
private List<LLUUID> m_animations = new List<LLUUID>();
|
private List<LLUUID> m_animations = new List<LLUUID>();
|
||||||
private List<int> m_animationSeqs = new List<int>();
|
private List<int> m_animationSeqs = new List<int>();
|
||||||
public Vector3 lastKnownAllowedPosition = new Vector3();
|
public Vector3 lastKnownAllowedPosition = new Vector3();
|
||||||
public bool sentMessageAboutRestrictedParcelFlyingDown = false;
|
public bool sentMessageAboutRestrictedParcelFlyingDown = false;
|
||||||
|
public float MovementSpeedMod = 1.0f; // rex
|
||||||
|
|
||||||
|
|
||||||
private bool m_updateflag = false;
|
private bool m_updateflag = false;
|
||||||
private byte m_movementflag = 0;
|
private byte m_movementflag = 0;
|
||||||
|
@ -315,8 +317,11 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
|
|
||||||
AbsolutePosition = m_controllingClient.StartPos;
|
AbsolutePosition = m_controllingClient.StartPos;
|
||||||
|
|
||||||
|
if (Animations == null)
|
||||||
|
{
|
||||||
Animations = new AvatarAnimations();
|
Animations = new AvatarAnimations();
|
||||||
Animations.LoadAnims();
|
Animations.LoadAnims();
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: m_animations and m_animationSeqs should always be of the same length.
|
// TODO: m_animations and m_animationSeqs should always be of the same length.
|
||||||
// Move them into an object to (hopefully) avoid threading issues.
|
// Move them into an object to (hopefully) avoid threading issues.
|
||||||
|
@ -385,7 +390,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
//{
|
//{
|
||||||
lock (m_partsUpdateQueue)
|
lock (m_partsUpdateQueue)
|
||||||
{
|
{
|
||||||
m_partsUpdateQueue.Enqueue(part);
|
m_partsUpdateQueue.ObjectUpdated(part);
|
||||||
}
|
}
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
@ -397,11 +402,6 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
|
|
||||||
public void SendPrimUpdates()
|
public void SendPrimUpdates()
|
||||||
{
|
{
|
||||||
// if (m_scene.QuadTree.GetNodeID(this.AbsolutePosition.X, this.AbsolutePosition.Y) != m_currentQuadNode)
|
|
||||||
//{
|
|
||||||
// this.UpdateQuadTreeNode();
|
|
||||||
//this.RefreshQuadObject();
|
|
||||||
//}
|
|
||||||
if (!m_gotAllObjectsInScene)
|
if (!m_gotAllObjectsInScene)
|
||||||
{
|
{
|
||||||
if (!m_isChildAgent || m_scene.m_sendTasksToChild)
|
if (!m_isChildAgent || m_scene.m_sendTasksToChild)
|
||||||
|
@ -410,14 +410,15 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
m_gotAllObjectsInScene = true;
|
m_gotAllObjectsInScene = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (m_partsUpdateQueue.Count > 0)
|
|
||||||
{
|
//Report avatar position to let queue sort objects (rex)
|
||||||
bool runUpdate = true;
|
m_partsUpdateQueue.UpdateAvatarPosition(AbsolutePosition);
|
||||||
|
|
||||||
int updateCount = 0;
|
int updateCount = 0;
|
||||||
while (runUpdate)
|
while (m_partsUpdateQueue.HasUpdates() && updateCount < 8)
|
||||||
{
|
{
|
||||||
SceneObjectPart part = m_partsUpdateQueue.Dequeue();
|
SceneObjectPart part = m_partsUpdateQueue.GetClosestUpdate();
|
||||||
if (m_updateTimes.ContainsKey(part.UUID))
|
if (part != null && m_updateTimes.ContainsKey(part.UUID))
|
||||||
{
|
{
|
||||||
ScenePartUpdate update = m_updateTimes[part.UUID];
|
ScenePartUpdate update = m_updateTimes[part.UUID];
|
||||||
|
|
||||||
|
@ -426,6 +427,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
// could have been sent in the last update - we still need to send the
|
// could have been sent in the last update - we still need to send the
|
||||||
// second here.
|
// second here.
|
||||||
|
|
||||||
|
|
||||||
if (update.LastFullUpdateTime < part.TimeStampFull)
|
if (update.LastFullUpdateTime < part.TimeStampFull)
|
||||||
{
|
{
|
||||||
//need to do a full update
|
//need to do a full update
|
||||||
|
@ -457,12 +459,6 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
m_updateTimes.Add(part.UUID, update);
|
m_updateTimes.Add(part.UUID, update);
|
||||||
updateCount++;
|
updateCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_partsUpdateQueue.Count < 1 || updateCount > 60)
|
|
||||||
{
|
|
||||||
runUpdate = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -752,7 +748,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((update_movementflag) || (update_rotation && DCFlagKeyPressed))
|
if ((update_movementflag) || (update_rotation)) // rex, DCFlagKeyPressed removed from update_rotation check, allows turning in place
|
||||||
{
|
{
|
||||||
AddNewMovement(agent_control_v3, q);
|
AddNewMovement(agent_control_v3, q);
|
||||||
UpdateMovementAnimations(update_movementflag);
|
UpdateMovementAnimations(update_movementflag);
|
||||||
|
@ -1096,7 +1092,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
Vector3 direc = rotation*vec;
|
Vector3 direc = rotation*vec;
|
||||||
direc.Normalize();
|
direc.Normalize();
|
||||||
|
|
||||||
direc *= 0.03f*128f;
|
direc *= 0.03f * 128f * MovementSpeedMod; // rex, MovementSpeedMod added
|
||||||
if (m_physicsActor.Flying)
|
if (m_physicsActor.Flying)
|
||||||
{
|
{
|
||||||
direc *= 4;
|
direc *= 4;
|
||||||
|
@ -1570,7 +1566,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
new PhysicsVector(AbsolutePosition.X, AbsolutePosition.Y,
|
new PhysicsVector(AbsolutePosition.X, AbsolutePosition.Y,
|
||||||
AbsolutePosition.Z);
|
AbsolutePosition.Z);
|
||||||
|
|
||||||
m_physicsActor = scene.AddAvatar(Firstname + "." + Lastname, pVec);
|
m_physicsActor = scene.AddAvatar(Firstname + "." + Lastname, pVec,LocalId); // rex, LocalId added
|
||||||
m_physicsActor.OnRequestTerseUpdate += SendTerseUpdateToAllClients;
|
m_physicsActor.OnRequestTerseUpdate += SendTerseUpdateToAllClients;
|
||||||
m_physicsActor.OnCollisionUpdate += PhysicsCollisionUpdate;
|
m_physicsActor.OnCollisionUpdate += PhysicsCollisionUpdate;
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,7 +89,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
rootPart.AbsolutePosition.Z + loadOffset.Z),
|
rootPart.AbsolutePosition.Z + loadOffset.Z),
|
||||||
new PhysicsVector(rootPart.Scale.X, rootPart.Scale.Y, rootPart.Scale.Z),
|
new PhysicsVector(rootPart.Scale.X, rootPart.Scale.Y, rootPart.Scale.Z),
|
||||||
new Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X,
|
new Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X,
|
||||||
rootPart.RotationOffset.Y, rootPart.RotationOffset.Z), UsePhysics);
|
rootPart.RotationOffset.Y, rootPart.RotationOffset.Z), UsePhysics, rootPart.LocalID);
|
||||||
rootPart.DoPhysicsPropertyUpdate(UsePhysics, true);
|
rootPart.DoPhysicsPropertyUpdate(UsePhysics, true);
|
||||||
}
|
}
|
||||||
primCount++;
|
primCount++;
|
||||||
|
@ -162,7 +162,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
rootPart.AbsolutePosition.Z),
|
rootPart.AbsolutePosition.Z),
|
||||||
new PhysicsVector(rootPart.Scale.X, rootPart.Scale.Y, rootPart.Scale.Z),
|
new PhysicsVector(rootPart.Scale.X, rootPart.Scale.Y, rootPart.Scale.Z),
|
||||||
new Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X,
|
new Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X,
|
||||||
rootPart.RotationOffset.Y, rootPart.RotationOffset.Z), UsePhysics);
|
rootPart.RotationOffset.Y, rootPart.RotationOffset.Z), UsePhysics, rootPart.LocalID);
|
||||||
rootPart.DoPhysicsPropertyUpdate(UsePhysics, true);
|
rootPart.DoPhysicsPropertyUpdate(UsePhysics, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,53 +27,133 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System;
|
||||||
using libsecondlife;
|
using libsecondlife;
|
||||||
using OpenSim.Region.Environment.Scenes;
|
using OpenSim.Region.Environment.Scenes;
|
||||||
|
|
||||||
|
|
||||||
namespace OpenSim.Region.Environment.Types
|
namespace OpenSim.Region.Environment.Types
|
||||||
{
|
{
|
||||||
public class UpdateQueue
|
public class UpdateQueue
|
||||||
{
|
{
|
||||||
private Queue<SceneObjectPart> m_queue;
|
class SceneObject
|
||||||
|
|
||||||
private List<LLUUID> m_ids;
|
|
||||||
|
|
||||||
public int Count
|
|
||||||
{
|
{
|
||||||
get { return m_queue.Count; }
|
//The distance after to include object size as a priority factor
|
||||||
|
static float m_maxSortDistance = 90 * 90;
|
||||||
|
|
||||||
|
public SceneObjectPart m_part;
|
||||||
|
public float m_priority;
|
||||||
|
|
||||||
|
public SceneObject(SceneObjectPart part)
|
||||||
|
{
|
||||||
|
m_part = part;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void DeterminePriority(LLVector3 pos)
|
||||||
|
{
|
||||||
|
m_priority = LLVector3.MagSquared(pos - m_part.AbsolutePosition);
|
||||||
|
m_priority -= LLVector3.MagSquared(m_part.Scale) * 12;
|
||||||
|
if (m_priority < 0)
|
||||||
|
{
|
||||||
|
m_priority = 0;
|
||||||
|
}
|
||||||
|
else if (m_priority > m_maxSortDistance)
|
||||||
|
{
|
||||||
|
m_priority = m_maxSortDistance;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class SceneObjectComparer : IComparer<SceneObject>
|
||||||
|
{
|
||||||
|
int IComparer<SceneObject>.Compare(SceneObject a, SceneObject b)
|
||||||
|
{
|
||||||
|
if (a.m_priority > b.m_priority)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
if (a.m_priority < b.m_priority)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<SceneObject> m_queue;
|
||||||
|
private Dictionary<LLUUID, LinkedListNode<SceneObjectPart>> m_ids;
|
||||||
|
|
||||||
|
float m_objectResortDistance = 15 * 15;
|
||||||
|
|
||||||
|
LLVector3 m_playerSpherePos = LLVector3.Zero;
|
||||||
|
|
||||||
|
DateTime m_forceRefreshTime;
|
||||||
|
bool m_forceRefreshTimeSet = false;
|
||||||
|
|
||||||
public UpdateQueue()
|
public UpdateQueue()
|
||||||
{
|
{
|
||||||
m_queue = new Queue<SceneObjectPart>();
|
m_queue = new List<SceneObject>();
|
||||||
m_ids = new List<LLUUID>();
|
m_ids = new Dictionary<LLUUID, LinkedListNode<SceneObjectPart>>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Enqueue(SceneObjectPart part)
|
public bool HasUpdates()
|
||||||
{
|
{
|
||||||
lock (m_ids)
|
|
||||||
{
|
|
||||||
if (!m_ids.Contains(part.UUID))
|
|
||||||
{
|
|
||||||
m_ids.Add(part.UUID);
|
|
||||||
m_queue.Enqueue(part);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public SceneObjectPart Dequeue()
|
|
||||||
{
|
|
||||||
SceneObjectPart part = null;
|
|
||||||
if (m_queue.Count > 0)
|
if (m_queue.Count > 0)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ObjectUpdated(SceneObjectPart part)
|
||||||
{
|
{
|
||||||
part = m_queue.Dequeue();
|
|
||||||
lock (m_ids)
|
lock (m_ids)
|
||||||
{
|
{
|
||||||
m_ids.Remove(part.UUID);
|
if (!m_ids.ContainsKey(part.UUID))
|
||||||
|
{
|
||||||
|
m_queue.Add(new SceneObject(part));
|
||||||
|
m_ids[part.UUID] = null;
|
||||||
}
|
}
|
||||||
|
else if (!m_forceRefreshTimeSet)
|
||||||
|
{
|
||||||
|
m_forceRefreshTime = DateTime.Now;
|
||||||
|
m_forceRefreshTime.AddSeconds(1);
|
||||||
|
m_forceRefreshTimeSet = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void UpdateAvatarPosition(LLVector3 avatarPosition)
|
||||||
|
{
|
||||||
|
if (LLVector3.MagSquared(m_playerSpherePos - avatarPosition) > m_objectResortDistance)
|
||||||
|
{
|
||||||
|
m_playerSpherePos = avatarPosition;
|
||||||
|
CollectNearestItems();
|
||||||
|
}
|
||||||
|
else if (m_forceRefreshTimeSet && m_forceRefreshTime < DateTime.Now)
|
||||||
|
{
|
||||||
|
m_playerSpherePos = avatarPosition;
|
||||||
|
CollectNearestItems();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public SceneObjectPart GetClosestUpdate()
|
||||||
|
{
|
||||||
|
SceneObjectPart part = m_queue[0].m_part;
|
||||||
|
|
||||||
|
lock (m_ids)
|
||||||
|
{
|
||||||
|
m_queue.RemoveAt(0);
|
||||||
|
m_ids.Remove(part.UUID);
|
||||||
}
|
}
|
||||||
|
|
||||||
return part;
|
return part;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void CollectNearestItems()
|
||||||
|
{
|
||||||
|
m_queue.ForEach(delegate(SceneObject obj) { obj.DeterminePriority(m_playerSpherePos); });
|
||||||
|
m_queue.Sort(new SceneObjectComparer());
|
||||||
|
|
||||||
|
m_forceRefreshTimeSet = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -115,6 +115,7 @@ namespace SimpleApp
|
||||||
public event UpdateInventoryItem OnUpdateInventoryItem;
|
public event UpdateInventoryItem OnUpdateInventoryItem;
|
||||||
public event CopyInventoryItem OnCopyInventoryItem;
|
public event CopyInventoryItem OnCopyInventoryItem;
|
||||||
public event MoveInventoryItem OnMoveInventoryItem;
|
public event MoveInventoryItem OnMoveInventoryItem;
|
||||||
|
public event RemoveInventoryItem OnRemoveInventoryItem; // rex
|
||||||
public event UDPAssetUploadRequest OnAssetUploadRequest;
|
public event UDPAssetUploadRequest OnAssetUploadRequest;
|
||||||
public event XferReceive OnXferReceive;
|
public event XferReceive OnXferReceive;
|
||||||
public event RequestXfer OnRequestXfer;
|
public event RequestXfer OnRequestXfer;
|
||||||
|
@ -123,6 +124,10 @@ namespace SimpleApp
|
||||||
public event UpdateTaskInventory OnUpdateTaskInventory;
|
public event UpdateTaskInventory OnUpdateTaskInventory;
|
||||||
public event RemoveTaskInventory OnRemoveTaskItem;
|
public event RemoveTaskInventory OnRemoveTaskItem;
|
||||||
|
|
||||||
|
public event RezSingleAttachmentFromInv OnRezSingleAttachmentFromInv;
|
||||||
|
public event ObjectAttach OnObjectAttach;
|
||||||
|
public event ObjectDetach OnObjectDetach;
|
||||||
|
|
||||||
public event UUIDNameRequest OnNameFromUUIDRequest;
|
public event UUIDNameRequest OnNameFromUUIDRequest;
|
||||||
|
|
||||||
public event ParcelPropertiesRequest OnParcelPropertiesRequest;
|
public event ParcelPropertiesRequest OnParcelPropertiesRequest;
|
||||||
|
@ -143,6 +148,11 @@ namespace SimpleApp
|
||||||
public event FriendActionDelegate OnDenyFriendRequest;
|
public event FriendActionDelegate OnDenyFriendRequest;
|
||||||
public event FriendshipTermination OnTerminateFriendship;
|
public event FriendshipTermination OnTerminateFriendship;
|
||||||
|
|
||||||
|
public event ReceiveRexClientScriptCmd OnReceiveRexClientScriptCmd; // rex
|
||||||
|
public event ObjectClickAction OnObjectClickAction; // rex
|
||||||
|
public event UpdateAssetMediaURL OnUpdateAssetMediaURL; // rex
|
||||||
|
public event TriggerSound OnTriggerSound;
|
||||||
|
|
||||||
#pragma warning restore 67
|
#pragma warning restore 67
|
||||||
|
|
||||||
private LLUUID myID = LLUUID.Random();
|
private LLUUID myID = LLUUID.Random();
|
||||||
|
@ -206,6 +216,14 @@ namespace SimpleApp
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public virtual void SendRexAppearance(LLUUID agentID, string avatarAddress) // rex
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual void SendRexScriptCommand(string vUnit, string vCommand, string vCmdParams) // rex
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
public virtual void Kick(string message)
|
public virtual void Kick(string message)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -253,6 +271,11 @@ namespace SimpleApp
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//rex
|
||||||
|
public virtual void SendMediaURL(LLUUID assetId, string mediaURL)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
public virtual void MoveAgentIntoRegion(RegionInfo regInfo, LLVector3 pos, LLVector3 look)
|
public virtual void MoveAgentIntoRegion(RegionInfo regInfo, LLVector3 pos, LLVector3 look)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -374,6 +397,11 @@ namespace SimpleApp
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SendTriggeredSound(LLUUID soundID, LLUUID ownerID, LLUUID objectID, LLUUID parentID, ulong handle, LLVector3 position, float gain)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public void SendAlertMessage(string message)
|
public void SendAlertMessage(string message)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -391,6 +419,10 @@ namespace SimpleApp
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SendDialog(string objectname, LLUUID objectID, LLUUID ownerID, string msg, LLUUID textureID, int ch, string[] buttonlabels)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
public virtual void SendRegionHandshake(RegionInfo regionInfo)
|
public virtual void SendRegionHandshake(RegionInfo regionInfo)
|
||||||
{
|
{
|
||||||
if (OnRegionHandShakeReply != null)
|
if (OnRegionHandShakeReply != null)
|
||||||
|
@ -500,5 +532,7 @@ namespace SimpleApp
|
||||||
public void SendLogoutPacket()
|
public void SendLogoutPacket()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SendScriptTeleportRequest(string objectName, string simName, LLVector3 simPosition, LLVector3 lookAt) { }
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -47,7 +47,7 @@ namespace SimpleApp
|
||||||
ModuleLoader moduleLoader, bool physicalPrim, bool ChildGetTasks)
|
ModuleLoader moduleLoader, bool physicalPrim, bool ChildGetTasks)
|
||||||
: base(
|
: base(
|
||||||
regionInfo, authen, permissionManager, commsMan, sceneGridService, assetCach, storeMan, httpServer,
|
regionInfo, authen, permissionManager, commsMan, sceneGridService, assetCach, storeMan, httpServer,
|
||||||
moduleLoader, false, true, false)
|
moduleLoader, false, true, false, false)
|
||||||
{
|
{
|
||||||
m_avatars = new List<ScenePresence>();
|
m_avatars = new List<ScenePresence>();
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,7 +88,7 @@ namespace SimpleApp
|
||||||
m_commsManager = localComms;
|
m_commsManager = localComms;
|
||||||
|
|
||||||
LocalLoginService loginService =
|
LocalLoginService loginService =
|
||||||
new LocalLoginService(userService, "", localComms, m_networkServersInfo, false);
|
new LocalLoginService(userService, "", localComms, m_networkServersInfo, false, false);
|
||||||
loginService.OnLoginToRegion += backendService.AddNewSession;
|
loginService.OnLoginToRegion += backendService.AddNewSession;
|
||||||
|
|
||||||
m_httpServer.AddXmlRPCHandler("login_to_simulator", loginService.XmlRpcLoginMethod);
|
m_httpServer.AddXmlRPCHandler("login_to_simulator", loginService.XmlRpcLoginMethod);
|
||||||
|
|
|
@ -75,7 +75,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
|
||||||
// Does nothing right now
|
// Does nothing right now
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsActor AddAvatar(string avName, PhysicsVector position)
|
public override PhysicsActor AddAvatar(string avName, PhysicsVector position, uint localID)
|
||||||
{
|
{
|
||||||
BasicActor act = new BasicActor();
|
BasicActor act = new BasicActor();
|
||||||
act.Position = position;
|
act.Position = position;
|
||||||
|
@ -104,13 +104,13 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position,
|
public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position,
|
||||||
PhysicsVector size, Quaternion rotation)
|
PhysicsVector size, Quaternion rotation, uint LocalID)
|
||||||
{
|
{
|
||||||
return AddPrimShape(primName, pbs, position, size, rotation, false);
|
return AddPrimShape(primName, pbs, position, size, rotation, false, LocalID);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position,
|
public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position,
|
||||||
PhysicsVector size, Quaternion rotation, bool isPhysical)
|
PhysicsVector size, Quaternion rotation, bool isPhysical, uint localID) // rex, modified
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -408,7 +408,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public override PhysicsActor AddAvatar(string avName, PhysicsVector position)
|
public override PhysicsActor AddAvatar(string avName, PhysicsVector position, uint localID)
|
||||||
{
|
{
|
||||||
PhysicsVector pos = new PhysicsVector();
|
PhysicsVector pos = new PhysicsVector();
|
||||||
pos.X = position.X;
|
pos.X = position.X;
|
||||||
|
@ -446,13 +446,13 @@ namespace OpenSim.Region.Physics.BulletXPlugin
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position,
|
public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position,
|
||||||
PhysicsVector size, AxiomQuaternion rotation)
|
PhysicsVector size, AxiomQuaternion rotation, uint localID)
|
||||||
{
|
{
|
||||||
return AddPrimShape(primName, pbs, position, size, rotation, false);
|
return AddPrimShape(primName, pbs, position, size, rotation, false,localID);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position,
|
public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position,
|
||||||
PhysicsVector size, AxiomQuaternion rotation, bool isPhysical)
|
PhysicsVector size, AxiomQuaternion rotation, bool isPhysical, uint LocalID)
|
||||||
{
|
{
|
||||||
PhysicsActor result;
|
PhysicsActor result;
|
||||||
|
|
||||||
|
@ -462,17 +462,17 @@ namespace OpenSim.Region.Physics.BulletXPlugin
|
||||||
/// support simple box & hollow box now; later, more shapes
|
/// support simple box & hollow box now; later, more shapes
|
||||||
if (pbs.ProfileHollow == 0)
|
if (pbs.ProfileHollow == 0)
|
||||||
{
|
{
|
||||||
result = AddPrim(primName, position, size, rotation, null, null, isPhysical);
|
result = AddPrim(primName, position, size, rotation, null, null, isPhysical, LocalID);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
IMesh mesh = mesher.CreateMesh(primName, pbs, size);
|
IMesh mesh = mesher.CreateMesh(primName, pbs, size);
|
||||||
result = AddPrim(primName, position, size, rotation, mesh, pbs, isPhysical);
|
result = AddPrim(primName, position, size, rotation, mesh, pbs, isPhysical, LocalID);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
result = AddPrim(primName, position, size, rotation, null, null, isPhysical);
|
result = AddPrim(primName, position, size, rotation, null, null, isPhysical, LocalID);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -480,7 +480,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
|
||||||
}
|
}
|
||||||
|
|
||||||
public PhysicsActor AddPrim(String name, PhysicsVector position, PhysicsVector size, AxiomQuaternion rotation,
|
public PhysicsActor AddPrim(String name, PhysicsVector position, PhysicsVector size, AxiomQuaternion rotation,
|
||||||
IMesh mesh, PrimitiveBaseShape pbs, bool isPhysical)
|
IMesh mesh, PrimitiveBaseShape pbs, bool isPhysical, uint localID)
|
||||||
{
|
{
|
||||||
BulletXPrim newPrim = null;
|
BulletXPrim newPrim = null;
|
||||||
lock (BulletXLock)
|
lock (BulletXLock)
|
||||||
|
|
|
@ -43,21 +43,21 @@ namespace OpenSim.Region.Physics.Manager
|
||||||
Unknown = 0,
|
Unknown = 0,
|
||||||
Agent = 1,
|
Agent = 1,
|
||||||
Prim = 2,
|
Prim = 2,
|
||||||
Ground = 3
|
Ground = 3,
|
||||||
|
PrimVolume = 4 // rex
|
||||||
}
|
}
|
||||||
|
|
||||||
public class CollisionEventUpdate : EventArgs
|
public class CollisionEventUpdate : EventArgs
|
||||||
{
|
{
|
||||||
// Raising the event on the object, so don't need to provide location.. further up the tree knows that info.
|
// Raising the event on the object, so don't need to provide location.. further up the tree knows that info.
|
||||||
|
|
||||||
|
|
||||||
public int m_colliderType;
|
public int m_colliderType;
|
||||||
public bool m_startOrEnd;
|
public bool m_startOrEnd;
|
||||||
//public uint m_LocalID;
|
public uint m_LocalID; // rex
|
||||||
public List<uint> m_objCollisionList;
|
public List<uint> m_objCollisionList;
|
||||||
|
|
||||||
public CollisionEventUpdate(uint localID, int colliderType, bool startOrEnd, List<uint> objCollisionList)
|
public CollisionEventUpdate(uint localID, int colliderType, bool startOrEnd, List<uint> objCollisionList)
|
||||||
{
|
{
|
||||||
|
m_LocalID = localID; // rex
|
||||||
m_colliderType = colliderType;
|
m_colliderType = colliderType;
|
||||||
m_startOrEnd = startOrEnd;
|
m_startOrEnd = startOrEnd;
|
||||||
m_objCollisionList = objCollisionList;
|
m_objCollisionList = objCollisionList;
|
||||||
|
@ -148,12 +148,10 @@ namespace OpenSim.Region.Physics.Manager
|
||||||
|
|
||||||
public virtual void SendCollisionUpdate(EventArgs e)
|
public virtual void SendCollisionUpdate(EventArgs e)
|
||||||
{
|
{
|
||||||
CollisionUpdate handler = OnCollisionUpdate;
|
// CollisionUpdate handler = OnCollisionUpdate;
|
||||||
if (handler != null)
|
if (OnCollisionUpdate != null)
|
||||||
{
|
|
||||||
OnCollisionUpdate(e);
|
OnCollisionUpdate(e);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public abstract PhysicsVector Position { get; set; }
|
public abstract PhysicsVector Position { get; set; }
|
||||||
|
@ -190,6 +188,11 @@ namespace OpenSim.Region.Physics.Manager
|
||||||
public abstract void AddForce(PhysicsVector force);
|
public abstract void AddForce(PhysicsVector force);
|
||||||
|
|
||||||
public abstract void SetMomentum(PhysicsVector momentum);
|
public abstract void SetMomentum(PhysicsVector momentum);
|
||||||
|
|
||||||
|
public virtual void SetCollisionMesh(byte[] vData, string MeshName, bool vbScaleMesh) { } // rex
|
||||||
|
public virtual void SetBoundsScaling(bool vbScaleMesh) { } // rex
|
||||||
|
public int NextPrimVolumeTime = 0; // rex
|
||||||
|
public uint m_localID; // rex
|
||||||
}
|
}
|
||||||
|
|
||||||
public class NullPhysicsActor : PhysicsActor
|
public class NullPhysicsActor : PhysicsActor
|
||||||
|
|
|
@ -103,6 +103,8 @@ namespace OpenSim.Region.Physics.Manager
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AddPlugin(string FileName)
|
private void AddPlugin(string FileName)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
Assembly pluginAssembly = Assembly.LoadFrom(FileName);
|
Assembly pluginAssembly = Assembly.LoadFrom(FileName);
|
||||||
|
|
||||||
|
@ -117,7 +119,7 @@ namespace OpenSim.Region.Physics.Manager
|
||||||
if (physTypeInterface != null)
|
if (physTypeInterface != null)
|
||||||
{
|
{
|
||||||
IPhysicsPlugin plug =
|
IPhysicsPlugin plug =
|
||||||
(IPhysicsPlugin) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
|
(IPhysicsPlugin)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
|
||||||
plug.Init();
|
plug.Init();
|
||||||
_PhysPlugins.Add(plug.GetName(), plug);
|
_PhysPlugins.Add(plug.GetName(), plug);
|
||||||
MainLog.Instance.Verbose("PHYSICS", "Added physics engine: " + plug.GetName());
|
MainLog.Instance.Verbose("PHYSICS", "Added physics engine: " + plug.GetName());
|
||||||
|
@ -128,7 +130,7 @@ namespace OpenSim.Region.Physics.Manager
|
||||||
if (meshTypeInterface != null)
|
if (meshTypeInterface != null)
|
||||||
{
|
{
|
||||||
IMeshingPlugin plug =
|
IMeshingPlugin plug =
|
||||||
(IMeshingPlugin) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
|
(IMeshingPlugin)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
|
||||||
_MeshPlugins.Add(plug.GetName(), plug);
|
_MeshPlugins.Add(plug.GetName(), plug);
|
||||||
MainLog.Instance.Verbose("PHYSICS", "Added meshing engine: " + plug.GetName());
|
MainLog.Instance.Verbose("PHYSICS", "Added meshing engine: " + plug.GetName());
|
||||||
}
|
}
|
||||||
|
@ -141,6 +143,11 @@ namespace OpenSim.Region.Physics.Manager
|
||||||
|
|
||||||
pluginAssembly = null;
|
pluginAssembly = null;
|
||||||
}
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
MainLog.Instance.Warn("PHYSICS", "Error loading plugin " + FileName + ": " + e.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//---
|
//---
|
||||||
public static void PhysicsPluginMessage(string message, bool isWarning)
|
public static void PhysicsPluginMessage(string message, bool isWarning)
|
||||||
|
|
|
@ -57,16 +57,16 @@ namespace OpenSim.Region.Physics.Manager
|
||||||
|
|
||||||
public abstract void Initialise(IMesher meshmerizer);
|
public abstract void Initialise(IMesher meshmerizer);
|
||||||
|
|
||||||
public abstract PhysicsActor AddAvatar(string avName, PhysicsVector position);
|
public abstract PhysicsActor AddAvatar(string avName, PhysicsVector position, uint localID); // rex, localID added
|
||||||
|
|
||||||
public abstract void RemoveAvatar(PhysicsActor actor);
|
public abstract void RemoveAvatar(PhysicsActor actor);
|
||||||
|
|
||||||
public abstract void RemovePrim(PhysicsActor prim);
|
public abstract void RemovePrim(PhysicsActor prim);
|
||||||
|
|
||||||
public abstract PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position,
|
public abstract PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position,
|
||||||
PhysicsVector size, Quaternion rotation); //To be removed
|
PhysicsVector size, Quaternion rotation, uint localID); //To be removed, rex, localID added
|
||||||
public abstract PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position,
|
public abstract PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position,
|
||||||
PhysicsVector size, Quaternion rotation, bool isPhysical);
|
PhysicsVector size, Quaternion rotation, bool isPhysical, uint localID); // rex, localID added
|
||||||
|
|
||||||
public abstract void AddPhysicsActorTaint(PhysicsActor prim);
|
public abstract void AddPhysicsActorTaint(PhysicsActor prim);
|
||||||
|
|
||||||
|
@ -90,7 +90,7 @@ namespace OpenSim.Region.Physics.Manager
|
||||||
// Does nothing right now
|
// Does nothing right now
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsActor AddAvatar(string avName, PhysicsVector position)
|
public override PhysicsActor AddAvatar(string avName, PhysicsVector position, uint localID)
|
||||||
{
|
{
|
||||||
MainLog.Instance.Verbose("PHYSICS", "NullPhysicsScene : AddAvatar({0})", position);
|
MainLog.Instance.Verbose("PHYSICS", "NullPhysicsScene : AddAvatar({0})", position);
|
||||||
return PhysicsActor.Null;
|
return PhysicsActor.Null;
|
||||||
|
@ -113,13 +113,13 @@ namespace OpenSim.Region.Physics.Manager
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position,
|
public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position,
|
||||||
PhysicsVector size, Quaternion rotation) //To be removed
|
PhysicsVector size, Quaternion rotation, uint localID) //To be removed
|
||||||
{
|
{
|
||||||
return AddPrimShape(primName, pbs, position, size, rotation, false);
|
return AddPrimShape(primName, pbs, position, size, rotation, false, localID);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position,
|
public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position,
|
||||||
PhysicsVector size, Quaternion rotation, bool isPhysical)
|
PhysicsVector size, Quaternion rotation, bool isPhysical, uint localID)
|
||||||
{
|
{
|
||||||
MainLog.Instance.Verbose("PHYSICS", "NullPhysicsScene : AddPrim({0},{1})", position, size);
|
MainLog.Instance.Verbose("PHYSICS", "NullPhysicsScene : AddPrim({0},{1})", position, size);
|
||||||
return PhysicsActor.Null;
|
return PhysicsActor.Null;
|
||||||
|
|
|
@ -31,6 +31,7 @@ using Axiom.Math;
|
||||||
using Ode.NET;
|
using Ode.NET;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Region.Physics.Manager;
|
using OpenSim.Region.Physics.Manager;
|
||||||
|
using System.Runtime.InteropServices; // rex
|
||||||
|
|
||||||
namespace OpenSim.Region.Physics.OdePlugin
|
namespace OpenSim.Region.Physics.OdePlugin
|
||||||
{
|
{
|
||||||
|
@ -71,14 +72,19 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
private bool jumping = false;
|
private bool jumping = false;
|
||||||
//private float gravityAccel;
|
//private float gravityAccel;
|
||||||
public IntPtr Body;
|
public IntPtr Body;
|
||||||
|
private GCHandle gchBody; // rex
|
||||||
|
|
||||||
private OdeScene _parent_scene;
|
private OdeScene _parent_scene;
|
||||||
public IntPtr Shell;
|
public IntPtr Shell;
|
||||||
|
private GCHandle gchShell; // rex
|
||||||
|
|
||||||
public IntPtr Amotor;
|
public IntPtr Amotor;
|
||||||
public d.Mass ShellMass;
|
public d.Mass ShellMass;
|
||||||
public bool collidelock = false;
|
public bool collidelock = false;
|
||||||
|
|
||||||
public OdeCharacter(String avName, OdeScene parent_scene, PhysicsVector pos)
|
public OdeCharacter(String avName, OdeScene parent_scene, PhysicsVector pos, uint localID) // rex, localID added
|
||||||
{
|
{
|
||||||
|
m_localID = localID; // rex
|
||||||
_velocity = new PhysicsVector();
|
_velocity = new PhysicsVector();
|
||||||
_target_velocity = new PhysicsVector();
|
_target_velocity = new PhysicsVector();
|
||||||
_position = pos;
|
_position = pos;
|
||||||
|
@ -98,8 +104,12 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
{
|
{
|
||||||
int dAMotorEuler = 1;
|
int dAMotorEuler = 1;
|
||||||
Shell = d.CreateCapsule(parent_scene.space, CAPSULE_RADIUS, CAPSULE_LENGTH);
|
Shell = d.CreateCapsule(parent_scene.space, CAPSULE_RADIUS, CAPSULE_LENGTH);
|
||||||
|
gchShell = GCHandle.Alloc(Shell, GCHandleType.Pinned); // rex
|
||||||
|
|
||||||
d.MassSetCapsule(out ShellMass, m_density, 3, CAPSULE_RADIUS, CAPSULE_LENGTH);
|
d.MassSetCapsule(out ShellMass, m_density, 3, CAPSULE_RADIUS, CAPSULE_LENGTH);
|
||||||
Body = d.BodyCreate(parent_scene.world);
|
Body = d.BodyCreate(parent_scene.world);
|
||||||
|
gchBody = GCHandle.Alloc(Body, GCHandleType.Pinned); // rex
|
||||||
|
|
||||||
d.BodySetMass(Body, ref ShellMass);
|
d.BodySetMass(Body, ref ShellMass);
|
||||||
d.BodySetPosition(Body, pos.X, pos.Y, pos.Z);
|
d.BodySetPosition(Body, pos.X, pos.Y, pos.Z);
|
||||||
d.GeomSetBody(Shell, Body);
|
d.GeomSetBody(Shell, Body);
|
||||||
|
@ -308,11 +318,15 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
|
|
||||||
CAPSULE_LENGTH = (SetSize.Z - ((SetSize.Z*0.43f))); // subtract 43% of the size
|
CAPSULE_LENGTH = (SetSize.Z - ((SetSize.Z*0.43f))); // subtract 43% of the size
|
||||||
d.BodyDestroy(Body);
|
d.BodyDestroy(Body);
|
||||||
|
gchBody.Free(); // rex
|
||||||
d.GeomDestroy(Shell);
|
d.GeomDestroy(Shell);
|
||||||
|
gchShell.Free(); // rex
|
||||||
//MainLog.Instance.Verbose("PHYSICS", "Set Avatar Height To: " + (CAPSULE_RADIUS + CAPSULE_LENGTH));
|
//MainLog.Instance.Verbose("PHYSICS", "Set Avatar Height To: " + (CAPSULE_RADIUS + CAPSULE_LENGTH));
|
||||||
Shell = d.CreateCapsule(_parent_scene.space, capsuleradius, CAPSULE_LENGTH);
|
Shell = d.CreateCapsule(_parent_scene.space, capsuleradius, CAPSULE_LENGTH);
|
||||||
|
gchShell = GCHandle.Alloc(Shell, GCHandleType.Pinned); // rex
|
||||||
d.MassSetCapsule(out ShellMass, m_density, 3, CAPSULE_RADIUS, CAPSULE_LENGTH);
|
d.MassSetCapsule(out ShellMass, m_density, 3, CAPSULE_RADIUS, CAPSULE_LENGTH);
|
||||||
Body = d.BodyCreate(_parent_scene.world);
|
Body = d.BodyCreate(_parent_scene.world);
|
||||||
|
gchBody = GCHandle.Alloc(Body, GCHandleType.Pinned); // rex
|
||||||
d.BodySetMass(Body, ref ShellMass);
|
d.BodySetMass(Body, ref ShellMass);
|
||||||
d.BodySetPosition(Body, _position.X, _position.Y,
|
d.BodySetPosition(Body, _position.X, _position.Y,
|
||||||
_position.Z + Math.Abs(CAPSULE_LENGTH - prevCapsule));
|
_position.Z + Math.Abs(CAPSULE_LENGTH - prevCapsule));
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue