First part of avatar persistence, currently only really works in standalone mode (with accounts_authenticate set to true), it also only currently has a mysql database connector. (sqlite one will follow soon). It also uses the tribalmedia database system, so this needs checking to see if the old problems with mono have been fixed.
To use, see the appearance section in opensim.ini.example, set "persist = true", then add the correct connection string for your database.(see mysql-AvatarAppearance.sql in share folder for a example of the table mysql table structure). This could possible be used in a very small grid, but would mean each region server would need to connect to the same mysql database. But the work to move the code to one of the grid servers shouldn't be too much.ThreadPoolClientBranch
parent
6fbc64af5e
commit
755ad9e3e0
|
@ -95,11 +95,13 @@ namespace OpenSim.Framework.Communications.Cache
|
||||||
// RestClient rc = new RestClient(_assetServerUrl);
|
// RestClient rc = new RestClient(_assetServerUrl);
|
||||||
MainLog.Instance.Verbose("ASSET", "Storing asset");
|
MainLog.Instance.Verbose("ASSET", "Storing asset");
|
||||||
//rc.AddResourcePath("assets");
|
//rc.AddResourcePath("assets");
|
||||||
|
|
||||||
// rc.RequestMethod = "POST";
|
// rc.RequestMethod = "POST";
|
||||||
// rc.Request(s);
|
// rc.Request(s);
|
||||||
//MainLog.Instance.Verbose("ASSET", "Stored {0}", rc);
|
//MainLog.Instance.Verbose("ASSET", "Stored {0}", rc);
|
||||||
MainLog.Instance.Verbose("ASSET", "Sending to " + _assetServerUrl + "/assets/");
|
MainLog.Instance.Verbose("ASSET", "Sending to " + _assetServerUrl + "/assets/");
|
||||||
RestObjectPoster.BeginPostObject<AssetBase>(_assetServerUrl + "/assets/", asset);
|
RestObjectPoster.BeginPostObject<AssetBase>(_assetServerUrl + "/assets/", asset);
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
|
|
@ -389,6 +389,7 @@ namespace OpenSim.Framework.Communications
|
||||||
dst.Write(buf, 0, length);
|
dst.Write(buf, 0, length);
|
||||||
length = src.Read(buf, 0, 1024);
|
length = src.Read(buf, 0, 1024);
|
||||||
}
|
}
|
||||||
|
|
||||||
_response = (HttpWebResponse) _request.GetResponse();
|
_response = (HttpWebResponse) _request.GetResponse();
|
||||||
|
|
||||||
// IAsyncResult responseAsyncResult = _request.BeginGetResponse(new AsyncCallback(ResponseIsReadyDelegate), _request);
|
// IAsyncResult responseAsyncResult = _request.BeginGetResponse(new AsyncCallback(ResponseIsReadyDelegate), _request);
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
using System.Data.Common;
|
using System.Data.Common;
|
||||||
using MySql.Data.MySqlClient;
|
using MySql.Data.MySqlClient;
|
||||||
// using TribalMedia.Framework.Data;
|
//using TribalMedia.Framework.Data;
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
namespace OpenSim.Framework.Data.MySQL
|
namespace OpenSim.Framework.Data.MySQL
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
public class MySQLDatabaseMapper : OpenSimDatabaseConnector
|
public class MySQLDatabaseMapper : OpenSimDatabaseConnector
|
||||||
{
|
{
|
||||||
public MySQLDatabaseMapper(string connectionString)
|
public MySQLDatabaseMapper(string connectionString)
|
||||||
|
@ -22,6 +23,6 @@ namespace OpenSim.Framework.Data.MySQL
|
||||||
{
|
{
|
||||||
return "?" + fieldName;
|
return "?" + fieldName;
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ using System.Data;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using libsecondlife;
|
using libsecondlife;
|
||||||
|
|
||||||
/*
|
|
||||||
using TribalMedia.Framework.Data;
|
using TribalMedia.Framework.Data;
|
||||||
|
|
||||||
namespace OpenSim.Framework.Data
|
namespace OpenSim.Framework.Data
|
||||||
|
@ -39,4 +39,4 @@ namespace OpenSim.Framework.Data
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
using System.Data;
|
using System.Data;
|
||||||
|
using System.Data.Common;
|
||||||
using libsecondlife;
|
using libsecondlife;
|
||||||
/*
|
using MySql.Data.MySqlClient;
|
||||||
|
|
||||||
using TribalMedia.Framework.Data;
|
using TribalMedia.Framework.Data;
|
||||||
|
|
||||||
namespace OpenSim.Framework.Data
|
namespace OpenSim.Framework.Data
|
||||||
|
@ -26,5 +28,25 @@ namespace OpenSim.Framework.Data
|
||||||
return new OpenSimDataReader(reader);
|
return new OpenSimDataReader(reader);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public class MySQLDatabaseMapper : OpenSimDatabaseConnector
|
||||||
|
{
|
||||||
|
public MySQLDatabaseMapper(string connectionString)
|
||||||
|
: base(connectionString)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public override DbConnection GetNewConnection()
|
||||||
|
{
|
||||||
|
MySqlConnection connection = new MySqlConnection(m_connectionString);
|
||||||
|
return connection;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string CreateParamName(string fieldName)
|
||||||
|
{
|
||||||
|
return "?" + fieldName;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ using System.Collections.Generic;
|
||||||
using System.Data.Common;
|
using System.Data.Common;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using libsecondlife;
|
using libsecondlife;
|
||||||
/*
|
|
||||||
using TribalMedia.Framework.Data;
|
using TribalMedia.Framework.Data;
|
||||||
|
|
||||||
namespace OpenSim.Framework.Data
|
namespace OpenSim.Framework.Data
|
||||||
|
@ -73,4 +73,4 @@ namespace OpenSim.Framework.Data
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
using System.Data;
|
using System.Data;
|
||||||
/*
|
|
||||||
using TribalMedia.Framework.Data;
|
using TribalMedia.Framework.Data;
|
||||||
|
|
||||||
namespace OpenSim.Framework.Data
|
namespace OpenSim.Framework.Data
|
||||||
|
@ -11,4 +11,3 @@ namespace OpenSim.Framework.Data
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
using System;
|
using System;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
//using TribalMedia.Framework.Data;
|
using TribalMedia.Framework.Data;
|
||||||
using libsecondlife;
|
using libsecondlife;
|
||||||
|
|
||||||
/*
|
|
||||||
namespace OpenSim.Framework.Data
|
namespace OpenSim.Framework.Data
|
||||||
{
|
{
|
||||||
public class PrimitiveBaseShapeRowMapper : BaseRowMapper<PrimitiveBaseShape>
|
public class PrimitiveBaseShapeRowMapper : BaseRowMapper<PrimitiveBaseShape>
|
||||||
|
@ -142,4 +142,4 @@ namespace OpenSim.Framework.Data
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
|
@ -76,6 +76,7 @@ namespace OpenSim
|
||||||
|
|
||||||
sim.StartUp();
|
sim.StartUp();
|
||||||
|
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
MainLog.Instance.MainLogPrompt();
|
MainLog.Instance.MainLogPrompt();
|
||||||
|
|
|
@ -351,6 +351,7 @@ namespace OpenSim.Region.ClientStack
|
||||||
if (m_debug > 0)
|
if (m_debug > 0)
|
||||||
{
|
{
|
||||||
string info = String.Empty;
|
string info = String.Empty;
|
||||||
|
|
||||||
if (m_debug < 255 && packet.Type == PacketType.AgentUpdate)
|
if (m_debug < 255 && packet.Type == PacketType.AgentUpdate)
|
||||||
return;
|
return;
|
||||||
if (m_debug < 254 && packet.Type == PacketType.ViewerEffect)
|
if (m_debug < 254 && packet.Type == PacketType.ViewerEffect)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) Contributors, http://opensimulator.org/
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
* * Redistributions of source code must retain the above copyright
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
|
|
@ -135,6 +135,7 @@ namespace OpenSim.Region.Environment
|
||||||
m_loadedSharedModules.Add(xmlRpcMod.Name, xmlRpcMod);
|
m_loadedSharedModules.Add(xmlRpcMod.Name, xmlRpcMod);
|
||||||
}
|
}
|
||||||
//TextureDownloadModule textureModule = new TextureDownloadModule();
|
//TextureDownloadModule textureModule = new TextureDownloadModule();
|
||||||
|
|
||||||
//LoadedSharedModules.Add(textureModule.Name, textureModule);
|
//LoadedSharedModules.Add(textureModule.Name, textureModule);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,216 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using OpenSim.Region.Environment.Scenes;
|
||||||
|
using OpenSim.Framework;
|
||||||
|
using TribalMedia.Framework.Data;
|
||||||
|
|
||||||
|
namespace OpenSim.Region.Environment.Modules
|
||||||
|
{
|
||||||
|
public class AppearanceRowMapper : BaseRowMapper<AvatarAppearance>
|
||||||
|
{
|
||||||
|
|
||||||
|
public AppearanceRowMapper(BaseSchema schema, AvatarAppearance obj)
|
||||||
|
: base(schema, obj)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class AppearanceTableMapper : BaseTableMapper<AppearanceRowMapper, Guid>
|
||||||
|
{
|
||||||
|
public AppearanceTableMapper(BaseDatabaseConnector database, string tableName)
|
||||||
|
: base(database, tableName)
|
||||||
|
{
|
||||||
|
BaseSchema<AppearanceRowMapper> rowMapperSchema = new BaseSchema<AppearanceRowMapper>(this);
|
||||||
|
m_schema = rowMapperSchema;
|
||||||
|
|
||||||
|
m_keyFieldMapper = rowMapperSchema.AddMapping<Guid>("UUID",
|
||||||
|
delegate(AppearanceRowMapper mapper) { return mapper.Object.ScenePresenceID.UUID; },
|
||||||
|
delegate(AppearanceRowMapper mapper, Guid value) { mapper.Object.ScenePresenceID = new libsecondlife.LLUUID(value.ToString()); });
|
||||||
|
|
||||||
|
rowMapperSchema.AddMapping<uint>("Serial",
|
||||||
|
delegate(AppearanceRowMapper mapper) { return (uint)mapper.Object.WearablesSerial; },
|
||||||
|
delegate(AppearanceRowMapper mapper, uint value) { mapper.Object.WearablesSerial = (int)value; });
|
||||||
|
|
||||||
|
rowMapperSchema.AddMapping<Guid>("WearableItem0",
|
||||||
|
delegate(AppearanceRowMapper mapper) { return mapper.Object.Wearables[0].ItemID.UUID; },
|
||||||
|
delegate(AppearanceRowMapper mapper, Guid value)
|
||||||
|
{
|
||||||
|
if (mapper.Object.Wearables == null)
|
||||||
|
{
|
||||||
|
mapper.Object.Wearables = new OpenSim.Framework.AvatarWearable[13];
|
||||||
|
for (int i = 0; i < 13; i++)
|
||||||
|
{
|
||||||
|
mapper.Object.Wearables[i] = new AvatarWearable();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mapper.Object.Wearables[0].ItemID = new libsecondlife.LLUUID(value.ToString());
|
||||||
|
});
|
||||||
|
|
||||||
|
rowMapperSchema.AddMapping<Guid>("WearableAsset0",
|
||||||
|
delegate(AppearanceRowMapper mapper) { return mapper.Object.Wearables[0].AssetID.UUID; },
|
||||||
|
delegate(AppearanceRowMapper mapper, Guid value)
|
||||||
|
{ mapper.Object.Wearables[0].AssetID = new libsecondlife.LLUUID(value.ToString()); });
|
||||||
|
|
||||||
|
rowMapperSchema.AddMapping<Guid>("WearableItem1",
|
||||||
|
delegate(AppearanceRowMapper mapper) { return mapper.Object.Wearables[1].ItemID.UUID; },
|
||||||
|
delegate(AppearanceRowMapper mapper, Guid value) { mapper.Object.Wearables[1].ItemID = new libsecondlife.LLUUID(value.ToString()); });
|
||||||
|
|
||||||
|
rowMapperSchema.AddMapping<Guid>("WearableAsset1",
|
||||||
|
delegate(AppearanceRowMapper mapper) { return mapper.Object.Wearables[1].AssetID.UUID; },
|
||||||
|
delegate(AppearanceRowMapper mapper, Guid value)
|
||||||
|
{ mapper.Object.Wearables[1].AssetID = new libsecondlife.LLUUID(value.ToString()); });
|
||||||
|
|
||||||
|
rowMapperSchema.AddMapping<Guid>("WearableItem2",
|
||||||
|
delegate(AppearanceRowMapper mapper) { return mapper.Object.Wearables[2].ItemID.UUID; },
|
||||||
|
delegate(AppearanceRowMapper mapper, Guid value) { mapper.Object.Wearables[2].ItemID = new libsecondlife.LLUUID(value.ToString()); });
|
||||||
|
|
||||||
|
rowMapperSchema.AddMapping<Guid>("WearableAsset2",
|
||||||
|
delegate(AppearanceRowMapper mapper) { return mapper.Object.Wearables[2].AssetID.UUID; },
|
||||||
|
delegate(AppearanceRowMapper mapper, Guid value)
|
||||||
|
{ mapper.Object.Wearables[2].AssetID = new libsecondlife.LLUUID(value.ToString()); });
|
||||||
|
|
||||||
|
rowMapperSchema.AddMapping<Guid>("WearableItem3",
|
||||||
|
delegate(AppearanceRowMapper mapper) { return mapper.Object.Wearables[3].ItemID.UUID; },
|
||||||
|
delegate(AppearanceRowMapper mapper, Guid value) { mapper.Object.Wearables[3].ItemID = new libsecondlife.LLUUID(value.ToString()); });
|
||||||
|
|
||||||
|
rowMapperSchema.AddMapping<Guid>("WearableAsset3",
|
||||||
|
delegate(AppearanceRowMapper mapper) { return mapper.Object.Wearables[3].AssetID.UUID; },
|
||||||
|
delegate(AppearanceRowMapper mapper, Guid value)
|
||||||
|
{ mapper.Object.Wearables[3].AssetID = new libsecondlife.LLUUID(value.ToString()); });
|
||||||
|
|
||||||
|
rowMapperSchema.AddMapping<Guid>("WearableItem4",
|
||||||
|
delegate(AppearanceRowMapper mapper) { return mapper.Object.Wearables[4].ItemID.UUID; },
|
||||||
|
delegate(AppearanceRowMapper mapper, Guid value) { mapper.Object.Wearables[4].ItemID = new libsecondlife.LLUUID(value.ToString()); });
|
||||||
|
|
||||||
|
rowMapperSchema.AddMapping<Guid>("WearableAsset4",
|
||||||
|
delegate(AppearanceRowMapper mapper) { return mapper.Object.Wearables[4].AssetID.UUID; },
|
||||||
|
delegate(AppearanceRowMapper mapper, Guid value)
|
||||||
|
{ mapper.Object.Wearables[4].AssetID = new libsecondlife.LLUUID(value.ToString()); });
|
||||||
|
|
||||||
|
rowMapperSchema.AddMapping<Guid>("WearableItem5",
|
||||||
|
delegate(AppearanceRowMapper mapper) { return mapper.Object.Wearables[5].ItemID.UUID; },
|
||||||
|
delegate(AppearanceRowMapper mapper, Guid value) { mapper.Object.Wearables[5].ItemID = new libsecondlife.LLUUID(value.ToString()); });
|
||||||
|
|
||||||
|
rowMapperSchema.AddMapping<Guid>("WearableAsset5",
|
||||||
|
delegate(AppearanceRowMapper mapper) { return mapper.Object.Wearables[5].AssetID.UUID; },
|
||||||
|
delegate(AppearanceRowMapper mapper, Guid value)
|
||||||
|
{ mapper.Object.Wearables[5].AssetID = new libsecondlife.LLUUID(value.ToString()); });
|
||||||
|
|
||||||
|
rowMapperSchema.AddMapping<Guid>("WearableItem6",
|
||||||
|
delegate(AppearanceRowMapper mapper) { return mapper.Object.Wearables[6].ItemID.UUID; },
|
||||||
|
delegate(AppearanceRowMapper mapper, Guid value) { mapper.Object.Wearables[6].ItemID = new libsecondlife.LLUUID(value.ToString()); });
|
||||||
|
|
||||||
|
rowMapperSchema.AddMapping<Guid>("WearableAsset6",
|
||||||
|
delegate(AppearanceRowMapper mapper) { return mapper.Object.Wearables[6].AssetID.UUID; },
|
||||||
|
delegate(AppearanceRowMapper mapper, Guid value)
|
||||||
|
{ mapper.Object.Wearables[6].AssetID = new libsecondlife.LLUUID(value.ToString()); });
|
||||||
|
|
||||||
|
rowMapperSchema.AddMapping<Guid>("WearableItem7",
|
||||||
|
delegate(AppearanceRowMapper mapper) { return mapper.Object.Wearables[7].ItemID.UUID; },
|
||||||
|
delegate(AppearanceRowMapper mapper, Guid value) { mapper.Object.Wearables[7].ItemID = new libsecondlife.LLUUID(value.ToString()); });
|
||||||
|
|
||||||
|
rowMapperSchema.AddMapping<Guid>("WearableAsset7",
|
||||||
|
delegate(AppearanceRowMapper mapper) { return mapper.Object.Wearables[7].AssetID.UUID; },
|
||||||
|
delegate(AppearanceRowMapper mapper, Guid value)
|
||||||
|
{ mapper.Object.Wearables[7].AssetID = new libsecondlife.LLUUID(value.ToString()); });
|
||||||
|
|
||||||
|
rowMapperSchema.AddMapping<Guid>("WearableItem8",
|
||||||
|
delegate(AppearanceRowMapper mapper) { return mapper.Object.Wearables[8].ItemID.UUID; },
|
||||||
|
delegate(AppearanceRowMapper mapper, Guid value) { mapper.Object.Wearables[8].ItemID = new libsecondlife.LLUUID(value.ToString()); });
|
||||||
|
|
||||||
|
rowMapperSchema.AddMapping<Guid>("WearableAsset8",
|
||||||
|
delegate(AppearanceRowMapper mapper) { return mapper.Object.Wearables[8].AssetID.UUID; },
|
||||||
|
delegate(AppearanceRowMapper mapper, Guid value)
|
||||||
|
{ mapper.Object.Wearables[8].AssetID = new libsecondlife.LLUUID(value.ToString()); });
|
||||||
|
|
||||||
|
rowMapperSchema.AddMapping<Guid>("WearableItem9",
|
||||||
|
delegate(AppearanceRowMapper mapper) { return mapper.Object.Wearables[9].ItemID.UUID; },
|
||||||
|
delegate(AppearanceRowMapper mapper, Guid value) { mapper.Object.Wearables[9].ItemID = new libsecondlife.LLUUID(value.ToString()); });
|
||||||
|
|
||||||
|
rowMapperSchema.AddMapping<Guid>("WearableAsset9",
|
||||||
|
delegate(AppearanceRowMapper mapper) { return mapper.Object.Wearables[9].AssetID.UUID; },
|
||||||
|
delegate(AppearanceRowMapper mapper, Guid value)
|
||||||
|
{ mapper.Object.Wearables[9].AssetID = new libsecondlife.LLUUID(value.ToString()); });
|
||||||
|
|
||||||
|
rowMapperSchema.AddMapping<Guid>("WearableItem10",
|
||||||
|
delegate(AppearanceRowMapper mapper) { return mapper.Object.Wearables[10].ItemID.UUID; },
|
||||||
|
delegate(AppearanceRowMapper mapper, Guid value) { mapper.Object.Wearables[10].ItemID = new libsecondlife.LLUUID(value.ToString()); });
|
||||||
|
|
||||||
|
rowMapperSchema.AddMapping<Guid>("WearableAsset10",
|
||||||
|
delegate(AppearanceRowMapper mapper) { return mapper.Object.Wearables[10].AssetID.UUID; },
|
||||||
|
delegate(AppearanceRowMapper mapper, Guid value)
|
||||||
|
{ mapper.Object.Wearables[10].AssetID = new libsecondlife.LLUUID(value.ToString()); });
|
||||||
|
|
||||||
|
rowMapperSchema.AddMapping<Guid>("WearableItem11",
|
||||||
|
delegate(AppearanceRowMapper mapper) { return mapper.Object.Wearables[11].ItemID.UUID; },
|
||||||
|
delegate(AppearanceRowMapper mapper, Guid value) { mapper.Object.Wearables[11].ItemID = new libsecondlife.LLUUID(value.ToString()); });
|
||||||
|
|
||||||
|
rowMapperSchema.AddMapping<Guid>("WearableAsset11",
|
||||||
|
delegate(AppearanceRowMapper mapper) { return mapper.Object.Wearables[11].AssetID.UUID; },
|
||||||
|
delegate(AppearanceRowMapper mapper, Guid value)
|
||||||
|
{ mapper.Object.Wearables[11].AssetID = new libsecondlife.LLUUID(value.ToString()); });
|
||||||
|
|
||||||
|
rowMapperSchema.AddMapping<Guid>("WearableItem12",
|
||||||
|
delegate(AppearanceRowMapper mapper) { return mapper.Object.Wearables[12].ItemID.UUID; },
|
||||||
|
delegate(AppearanceRowMapper mapper, Guid value) { mapper.Object.Wearables[12].ItemID = new libsecondlife.LLUUID(value.ToString()); });
|
||||||
|
|
||||||
|
rowMapperSchema.AddMapping<Guid>("WearableAsset12",
|
||||||
|
delegate(AppearanceRowMapper mapper) { return mapper.Object.Wearables[12].AssetID.UUID; },
|
||||||
|
delegate(AppearanceRowMapper mapper, Guid value)
|
||||||
|
{ mapper.Object.Wearables[12].AssetID = new libsecondlife.LLUUID(value.ToString()); });
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Add(Guid userID, AvatarAppearance appearance)
|
||||||
|
{
|
||||||
|
AppearanceRowMapper mapper = CreateRowMapper(appearance);
|
||||||
|
return Add(mapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Update(Guid userID, AvatarAppearance appearance)
|
||||||
|
{
|
||||||
|
AppearanceRowMapper mapper = CreateRowMapper(appearance);
|
||||||
|
return Update(appearance.ScenePresenceID.UUID, mapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected AppearanceRowMapper CreateRowMapper(AvatarAppearance appearance)
|
||||||
|
{
|
||||||
|
return new AppearanceRowMapper(m_schema, appearance);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected AppearanceRowMapper CreateRowMapper()
|
||||||
|
{
|
||||||
|
return CreateRowMapper(new AvatarAppearance());
|
||||||
|
}
|
||||||
|
|
||||||
|
protected AppearanceRowMapper FromReader(BaseDataReader reader, AvatarAppearance appearance)
|
||||||
|
{
|
||||||
|
AppearanceRowMapper mapper = CreateRowMapper(appearance);
|
||||||
|
mapper.FillObject(reader);
|
||||||
|
return mapper;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override AppearanceRowMapper FromReader(BaseDataReader reader)
|
||||||
|
{
|
||||||
|
AppearanceRowMapper mapper = CreateRowMapper();
|
||||||
|
mapper.FillObject(reader);
|
||||||
|
return mapper;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool TryGetValue(Guid presenceID, out AvatarAppearance val)
|
||||||
|
{
|
||||||
|
AppearanceRowMapper mapper;
|
||||||
|
if (TryGetValue(presenceID, out mapper))
|
||||||
|
{
|
||||||
|
val = mapper.Object;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
val = null;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -35,6 +35,8 @@ using OpenSim.Framework.Communications.Cache;
|
||||||
using OpenSim.Framework.Console;
|
using OpenSim.Framework.Console;
|
||||||
using OpenSim.Region.Environment.Interfaces;
|
using OpenSim.Region.Environment.Interfaces;
|
||||||
using OpenSim.Region.Environment.Scenes;
|
using OpenSim.Region.Environment.Scenes;
|
||||||
|
using OpenSim.Framework.Data;
|
||||||
|
using TribalMedia.Framework.Data;
|
||||||
|
|
||||||
namespace OpenSim.Region.Environment.Modules
|
namespace OpenSim.Region.Environment.Modules
|
||||||
{
|
{
|
||||||
|
@ -43,6 +45,12 @@ namespace OpenSim.Region.Environment.Modules
|
||||||
private Scene m_scene = null;
|
private Scene m_scene = null;
|
||||||
private readonly Dictionary<LLUUID, AvatarAppearance> m_avatarsAppearance = new Dictionary<LLUUID, AvatarAppearance>();
|
private readonly Dictionary<LLUUID, AvatarAppearance> m_avatarsAppearance = new Dictionary<LLUUID, AvatarAppearance>();
|
||||||
|
|
||||||
|
private bool m_enablePersist = false;
|
||||||
|
private string m_connectionString;
|
||||||
|
private bool m_configured = false;
|
||||||
|
private BaseDatabaseConnector m_databaseMapper;
|
||||||
|
private AppearanceTableMapper m_appearanceMapper;
|
||||||
|
|
||||||
public bool TryGetAvatarAppearance(LLUUID avatarId, out AvatarAppearance appearance)
|
public bool TryGetAvatarAppearance(LLUUID avatarId, out AvatarAppearance appearance)
|
||||||
{
|
{
|
||||||
if (m_avatarsAppearance.ContainsKey(avatarId))
|
if (m_avatarsAppearance.ContainsKey(avatarId))
|
||||||
|
@ -50,22 +58,31 @@ namespace OpenSim.Region.Environment.Modules
|
||||||
appearance = m_avatarsAppearance[avatarId];
|
appearance = m_avatarsAppearance[avatarId];
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
if (m_enablePersist)
|
||||||
{
|
{
|
||||||
AvatarWearable[] wearables;
|
if (m_appearanceMapper.TryGetValue(avatarId.UUID, out appearance))
|
||||||
byte[] visualParams;
|
|
||||||
GetDefaultAvatarAppearance(out wearables, out visualParams);
|
|
||||||
appearance = new AvatarAppearance(avatarId, wearables, visualParams);
|
|
||||||
try
|
|
||||||
{
|
{
|
||||||
|
appearance.VisualParams = GetDefaultVisualParams();
|
||||||
|
appearance.TextureEntry = AvatarAppearance.GetDefaultTextureEntry();
|
||||||
m_avatarsAppearance[avatarId] = appearance;
|
m_avatarsAppearance[avatarId] = appearance;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
catch (NullReferenceException)
|
|
||||||
{
|
|
||||||
MainLog.Instance.Error("AVATAR", "Unable to load appearance for uninitialized avatar");
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//not found a appearance for user, so create a new one
|
||||||
|
AvatarWearable[] wearables;
|
||||||
|
byte[] visualParams;
|
||||||
|
GetDefaultAvatarAppearance(out wearables, out visualParams);
|
||||||
|
appearance = new AvatarAppearance(avatarId, wearables, visualParams);
|
||||||
|
|
||||||
|
m_avatarsAppearance[avatarId] = appearance;
|
||||||
|
if (m_enablePersist)
|
||||||
|
{
|
||||||
|
m_appearanceMapper.Add(avatarId.UUID, appearance);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Initialise(Scene scene, IConfigSource source)
|
public void Initialise(Scene scene, IConfigSource source)
|
||||||
|
@ -77,6 +94,24 @@ namespace OpenSim.Region.Environment.Modules
|
||||||
{
|
{
|
||||||
m_scene = scene;
|
m_scene = scene;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!m_configured)
|
||||||
|
{
|
||||||
|
m_configured = true;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
m_enablePersist = source.Configs["Appearance"].GetBoolean("persist", false);
|
||||||
|
m_connectionString = source.Configs["Appearance"].GetString("connection_string", "");
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
if (m_enablePersist)
|
||||||
|
{
|
||||||
|
m_databaseMapper = new MySQLDatabaseMapper(m_connectionString);
|
||||||
|
m_appearanceMapper = new AppearanceTableMapper(m_databaseMapper, "AvatarAppearance");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void PostInitialise()
|
public void PostInitialise()
|
||||||
|
@ -109,7 +144,7 @@ namespace OpenSim.Region.Environment.Modules
|
||||||
|
|
||||||
public void AvatarIsWearing(Object sender, AvatarWearingArgs e)
|
public void AvatarIsWearing(Object sender, AvatarWearingArgs e)
|
||||||
{
|
{
|
||||||
IClientAPI clientView = (IClientAPI) sender;
|
IClientAPI clientView = (IClientAPI)sender;
|
||||||
CachedUserInfo profile = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(clientView.AgentId);
|
CachedUserInfo profile = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(clientView.AgentId);
|
||||||
if (profile != null)
|
if (profile != null)
|
||||||
{
|
{
|
||||||
|
@ -134,6 +169,11 @@ namespace OpenSim.Region.Environment.Modules
|
||||||
AvatarAppearance avatAppearance = m_avatarsAppearance[clientView.AgentId];
|
AvatarAppearance avatAppearance = m_avatarsAppearance[clientView.AgentId];
|
||||||
avatAppearance.Wearables[wear.Type].AssetID = assetId;
|
avatAppearance.Wearables[wear.Type].AssetID = assetId;
|
||||||
avatAppearance.Wearables[wear.Type].ItemID = wear.ItemID;
|
avatAppearance.Wearables[wear.Type].ItemID = wear.ItemID;
|
||||||
|
|
||||||
|
if (m_enablePersist)
|
||||||
|
{
|
||||||
|
m_appearanceMapper.Update(clientView.AgentId.UUID, avatAppearance);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -170,31 +170,9 @@ namespace OpenSim.Region.Environment
|
||||||
// the administrator object permissions to take effect.
|
// the administrator object permissions to take effect.
|
||||||
LLUUID objectOwner = task.OwnerID;
|
LLUUID objectOwner = task.OwnerID;
|
||||||
|
|
||||||
//return task.RootPart.ObjectFlags;task.RootPart.ObjectFlags |
|
|
||||||
|
|
||||||
uint objectOwnerMask = task.RootPart.ObjectFlags;
|
uint objectOwnerMask = task.RootPart.ObjectFlags;
|
||||||
|
objectOwnerMask = ApplyObjectModifyMasks(task.RootPart.OwnerMask, objectOwnerMask);
|
||||||
|
|
||||||
if((task.RootPart.OwnerMask & (uint)PermissionMask.Copy) != 0)
|
|
||||||
{
|
|
||||||
objectOwnerMask |= (uint)LLObject.ObjectFlags.ObjectCopy;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((task.RootPart.OwnerMask & (uint) PermissionMask.Move) != 0)
|
|
||||||
{
|
|
||||||
objectOwnerMask |= (uint)LLObject.ObjectFlags.ObjectMove;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((task.RootPart.OwnerMask & (uint) PermissionMask.Modify) != 0)
|
|
||||||
{
|
|
||||||
objectOwnerMask |= (uint)LLObject.ObjectFlags.ObjectModify;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((task.RootPart.OwnerMask & (uint) PermissionMask.Transfer) != 0)
|
|
||||||
{
|
|
||||||
objectOwnerMask |= (uint)LLObject.ObjectFlags.ObjectTransfer;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint objectGroupMask = task.RootPart.ObjectFlags | task.RootPart.GroupMask;
|
|
||||||
uint objectEveryoneMask = task.RootPart.ObjectFlags | task.RootPart.EveryoneMask;
|
uint objectEveryoneMask = task.RootPart.ObjectFlags | task.RootPart.EveryoneMask;
|
||||||
|
|
||||||
if (m_bypassPermissions)
|
if (m_bypassPermissions)
|
||||||
|
@ -240,6 +218,31 @@ namespace OpenSim.Region.Environment
|
||||||
return objectEveryoneMask;
|
return objectEveryoneMask;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private uint ApplyObjectModifyMasks(uint parentMask, uint objectOwnerMask)
|
||||||
|
{
|
||||||
|
if ((parentMask & (uint)PermissionMask.Copy) != 0)
|
||||||
|
{
|
||||||
|
objectOwnerMask |= (uint)LLObject.ObjectFlags.ObjectCopy;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((parentMask & (uint)PermissionMask.Move) != 0)
|
||||||
|
{
|
||||||
|
objectOwnerMask |= (uint)LLObject.ObjectFlags.ObjectMove;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((parentMask & (uint)PermissionMask.Modify) != 0)
|
||||||
|
{
|
||||||
|
objectOwnerMask |= (uint)LLObject.ObjectFlags.ObjectModify;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((parentMask & (uint)PermissionMask.Transfer) != 0)
|
||||||
|
{
|
||||||
|
objectOwnerMask |= (uint)LLObject.ObjectFlags.ObjectTransfer;
|
||||||
|
}
|
||||||
|
return objectOwnerMask;
|
||||||
|
}
|
||||||
|
|
||||||
protected virtual bool GenericObjectPermission(LLUUID currentUser, LLUUID objId)
|
protected virtual bool GenericObjectPermission(LLUUID currentUser, LLUUID objId)
|
||||||
{
|
{
|
||||||
// Default: deny
|
// Default: deny
|
||||||
|
|
|
@ -35,8 +35,20 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
public class AvatarAppearance
|
public class AvatarAppearance
|
||||||
{
|
{
|
||||||
protected LLUUID m_scenePresenceID;
|
protected LLUUID m_scenePresenceID;
|
||||||
|
|
||||||
|
public LLUUID ScenePresenceID
|
||||||
|
{
|
||||||
|
get { return m_scenePresenceID; }
|
||||||
|
set { m_scenePresenceID = value; }
|
||||||
|
}
|
||||||
protected int m_wearablesSerial = 1;
|
protected int m_wearablesSerial = 1;
|
||||||
|
|
||||||
|
public int WearablesSerial
|
||||||
|
{
|
||||||
|
get { return m_wearablesSerial; }
|
||||||
|
set { m_wearablesSerial = value; }
|
||||||
|
}
|
||||||
|
|
||||||
protected byte[] m_visualParams;
|
protected byte[] m_visualParams;
|
||||||
|
|
||||||
public byte[] VisualParams
|
public byte[] VisualParams
|
||||||
|
|
|
@ -72,6 +72,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
|
|
||||||
public partial class SceneObjectPart : IScriptHost
|
public partial class SceneObjectPart : IScriptHost
|
||||||
{
|
{
|
||||||
|
|
||||||
[XmlIgnore] public PhysicsActor PhysActor = null;
|
[XmlIgnore] public PhysicsActor PhysActor = null;
|
||||||
|
|
||||||
public LLUUID LastOwnerID;
|
public LLUUID LastOwnerID;
|
||||||
|
@ -764,11 +765,13 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
|
|
||||||
public void TrimPermissions()
|
public void TrimPermissions()
|
||||||
{
|
{
|
||||||
|
|
||||||
BaseMask &= (uint)PermissionMask.All;
|
BaseMask &= (uint)PermissionMask.All;
|
||||||
OwnerMask &= (uint)PermissionMask.All;
|
OwnerMask &= (uint)PermissionMask.All;
|
||||||
GroupMask &= (uint)PermissionMask.All;
|
GroupMask &= (uint)PermissionMask.All;
|
||||||
EveryoneMask &= (uint)PermissionMask.All;
|
EveryoneMask &= (uint)PermissionMask.All;
|
||||||
NextOwnerMask &= (uint)PermissionMask.All;
|
NextOwnerMask &= (uint)PermissionMask.All;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -138,4 +138,5 @@ namespace TribalMedia.Framework.Data
|
||||||
|
|
||||||
public abstract BaseDataReader CreateReader(IDataReader reader);
|
public abstract BaseDataReader CreateReader(IDataReader reader);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -241,3 +241,7 @@ CompileWithDebugInformation=true
|
||||||
CleanUpOldScriptsOnStartup=true
|
CleanUpOldScriptsOnStartup=true
|
||||||
|
|
||||||
|
|
||||||
|
[Appearance]
|
||||||
|
persist = false
|
||||||
|
connection_string = "Data Source=localhost;Database=avatar_appearance;User ID=root;Password=xxxx;pooling=false;"
|
||||||
|
|
||||||
|
|
|
@ -141,6 +141,7 @@
|
||||||
<Reference name="XMLRPC.dll"/>
|
<Reference name="XMLRPC.dll"/>
|
||||||
<Reference name="libsecondlife.dll"/>
|
<Reference name="libsecondlife.dll"/>
|
||||||
<Reference name="OpenSim.Framework"/>
|
<Reference name="OpenSim.Framework"/>
|
||||||
|
<Reference name="MySql.Data.dll"/>
|
||||||
<Reference name="TribalMedia.Framework.Data"/>
|
<Reference name="TribalMedia.Framework.Data"/>
|
||||||
<Files>
|
<Files>
|
||||||
<Match pattern="*.cs" recurse="true"/>
|
<Match pattern="*.cs" recurse="true"/>
|
||||||
|
@ -651,6 +652,7 @@
|
||||||
<Reference name="Microsoft.JScript"/>
|
<Reference name="Microsoft.JScript"/>
|
||||||
<Reference name="XMLRPC.dll"/>
|
<Reference name="XMLRPC.dll"/>
|
||||||
<Reference name="OpenSim.Framework.Communications"/>
|
<Reference name="OpenSim.Framework.Communications"/>
|
||||||
|
<Reference name="TribalMedia.Framework.Data"/>
|
||||||
<Reference name="Nini.dll" />
|
<Reference name="Nini.dll" />
|
||||||
<Files>
|
<Files>
|
||||||
<Match pattern="*.cs" recurse="true"/>
|
<Match pattern="*.cs" recurse="true"/>
|
||||||
|
|
|
@ -0,0 +1,42 @@
|
||||||
|
--
|
||||||
|
-- Create schema avatar_appearance
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE DATABASE IF NOT EXISTS avatar_appearance;
|
||||||
|
USE avatar_appearance;
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS `avatarappearance`;
|
||||||
|
CREATE TABLE `avatarappearance` (
|
||||||
|
`UUID` char(36) NOT NULL,
|
||||||
|
`Serial` int(10) unsigned NOT NULL,
|
||||||
|
`WearableItem0` char(36) NOT NULL,
|
||||||
|
`WearableAsset0` char(36) NOT NULL,
|
||||||
|
`WearableItem1` char(36) NOT NULL,
|
||||||
|
`WearableAsset1` char(36) NOT NULL,
|
||||||
|
`WearableItem2` char(36) NOT NULL,
|
||||||
|
`WearableAsset2` char(36) NOT NULL,
|
||||||
|
`WearableItem3` char(36) NOT NULL,
|
||||||
|
`WearableAsset3` char(36) NOT NULL,
|
||||||
|
`WearableItem4` char(36) NOT NULL,
|
||||||
|
`WearableAsset4` char(36) NOT NULL,
|
||||||
|
`WearableItem5` char(36) NOT NULL,
|
||||||
|
`WearableAsset5` char(36) NOT NULL,
|
||||||
|
`WearableItem6` char(36) NOT NULL,
|
||||||
|
`WearableAsset6` char(36) NOT NULL,
|
||||||
|
`WearableItem7` char(36) NOT NULL,
|
||||||
|
`WearableAsset7` char(36) NOT NULL,
|
||||||
|
`WearableItem8` char(36) NOT NULL,
|
||||||
|
`WearableAsset8` char(36) NOT NULL,
|
||||||
|
`WearableItem9` char(36) NOT NULL,
|
||||||
|
`WearableAsset9` char(36) NOT NULL,
|
||||||
|
`WearableItem10` char(36) NOT NULL,
|
||||||
|
`WearableAsset10` char(36) NOT NULL,
|
||||||
|
`WearableItem11` char(36) NOT NULL,
|
||||||
|
`WearableAsset11` char(36) NOT NULL,
|
||||||
|
`WearableItem12` char(36) NOT NULL,
|
||||||
|
`WearableAsset12` char(36) NOT NULL,
|
||||||
|
|
||||||
|
|
||||||
|
PRIMARY KEY (`UUID`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
|
Loading…
Reference in New Issue