Attachment persistence (Mantis #1711)

Change user server to handle attachment assets record properly. Ensure
that attachments are not re-rezzed on region crossing. Persistence
will NOT WORK with earliser UGAI!!
Change region server to match.
0.6.0-stable
Melanie Thielker 2008-08-19 18:34:46 +00:00
parent c71d6f05a7
commit 41440e184b
9 changed files with 52 additions and 169 deletions

View File

@ -892,37 +892,6 @@ namespace OpenSim.Data.MSSQL
} }
} }
/// <summary>
/// add an attachement to an avatar
/// </summary>
/// <param name="user">the avatar UUID</param>
/// <param name="item">the item UUID</param>
override public void AddAttachment(LLUUID user, LLUUID item)
{
// TBI?
}
/// <summary>
/// Remove an attachement from an avatar
/// </summary>
/// <param name="user">the avatar UUID</param>
/// <param name="item">the item UUID</param>
override public void RemoveAttachment(LLUUID user, LLUUID item)
{
// TBI?
}
/// <summary>
/// get (fetch?) all attached item to an avatar
/// </summary>
/// <param name="user">the avatar UUID</param>
/// <returns>List of attached item</returns>
/// <remarks>return an empty list</remarks>
override public List<LLUUID> GetAttachments(LLUUID user)
{
return new List<LLUUID>();
}
/// <summary> /// <summary>
/// Database provider name /// Database provider name
/// </summary> /// </summary>
@ -948,5 +917,9 @@ namespace OpenSim.Data.MSSQL
public void runQuery(string query) public void runQuery(string query)
{ {
} }
override public void ResetAttachments(LLUUID userID)
{
}
} }
} }

View File

@ -778,36 +778,6 @@ namespace OpenSim.Data.MySQL
} }
} }
/// <summary>
/// Adds an attachment item to a user
/// </summary>
/// <param name="user">the user UUID</param>
/// <param name="item">the item UUID</param>
override public void AddAttachment(LLUUID user, LLUUID item)
{
return;
}
/// <summary>
/// Removes an attachment from a user
/// </summary>
/// <param name="user">the user UUID</param>
/// <param name="item">the item UUID</param>
override public void RemoveAttachment(LLUUID user, LLUUID item)
{
return;
}
/// <summary>
/// Get the list of item attached to a user
/// </summary>
/// <param name="user">the user UUID</param>
/// <returns>UUID list of attached item</returns>
override public List<LLUUID> GetAttachments(LLUUID user)
{
return new List<LLUUID>();
}
/// <summary> /// <summary>
/// Database provider name /// Database provider name
/// </summary> /// </summary>
@ -845,5 +815,14 @@ namespace OpenSim.Data.MySQL
{ {
database.writeAttachments(agentID, data); database.writeAttachments(agentID, data);
} }
override public void ResetAttachments(LLUUID userID)
{
MySqlCommand cmd = (MySqlCommand) (database.Connection.CreateCommand());
cmd.CommandText = "update avatarattachments set asset = '00000000-0000-0000-0000-000000000000' where UUID = ?uuid";
cmd.Parameters.AddWithValue("?uuid", userID.ToString());
cmd.ExecuteNonQuery();
}
} }
} }

View File

@ -303,19 +303,8 @@ namespace OpenSim.Data.NHibernate
} }
} }
override public void AddAttachment(LLUUID user, LLUUID item) public override void ResetAttachments(LLUUID userID)
{ {
return;
}
override public void RemoveAttachment(LLUUID user, LLUUID item)
{
return;
}
override public List<LLUUID> GetAttachments(LLUUID user)
{
return new List<LLUUID>();
} }
public override string Name { public override string Name {

View File

@ -582,39 +582,6 @@ namespace OpenSim.Data.SQLite
aplist[user] = appearance; aplist[user] = appearance;
} }
/// <summary>
/// Add an attachment item to an avatar
/// </summary>
/// <param name="user">the user UUID</param>
/// <param name="item">the item UUID</param>
/// <remarks>DO NOTHING ?</remarks>
override public void AddAttachment(LLUUID user, LLUUID item)
{
return;
}
/// <summary>
/// Remove an attachement item from an avatar
/// </summary>
/// <param name="user">the user UUID</param>
/// <param name="item">the item UUID</param>
/// <remarks>DO NOTHING ?</remarks>
override public void RemoveAttachment(LLUUID user, LLUUID item)
{
return;
}
/// <summary>
/// Get list of attached item
/// </summary>
/// <param name="user">the user UUID</param>
/// <returns>List of attached item</returns>
/// <remarks>DO NOTHING ?</remarks>
override public List<LLUUID> GetAttachments(LLUUID user)
{
return new List<LLUUID>();
}
/// <summary> /// <summary>
/// Returns the name of the storage provider /// Returns the name of the storage provider
/// </summary> /// </summary>
@ -1040,5 +1007,9 @@ namespace OpenSim.Data.SQLite
// return true; // return true;
} }
override public void ResetAttachments(LLUUID userID)
{
}
} }
} }

View File

@ -72,9 +72,7 @@ namespace OpenSim.Data
// aplist[user] = appearance; // aplist[user] = appearance;
// m_log.Info("[APPEARANCE] Setting appearance for " + user.ToString() + appearance.ToString()); // m_log.Info("[APPEARANCE] Setting appearance for " + user.ToString() + appearance.ToString());
// } // }
public abstract void AddAttachment(LLUUID user, LLUUID item); public abstract void ResetAttachments(LLUUID userID);
public abstract void RemoveAttachment(LLUUID user, LLUUID item);
public abstract List<LLUUID> GetAttachments(LLUUID user);
public abstract string Version {get;} public abstract string Version {get;}
public abstract string Name {get;} public abstract string Name {get;}

View File

@ -220,6 +220,9 @@ namespace OpenSim.Framework.Communications
} }
// Otherwise... // Otherwise...
// Create a new agent session // Create a new agent session
m_userManager.ResetAttachments(userProfile.ID);
CreateAgent(userProfile, request); CreateAgent(userProfile, request);
try try
@ -390,6 +393,9 @@ namespace OpenSim.Framework.Communications
// Otherwise... // Otherwise...
// Create a new agent session // Create a new agent session
m_userManager.ResetAttachments(userProfile.ID);
CreateAgent(userProfile, request); CreateAgent(userProfile, request);
try try

View File

@ -83,6 +83,13 @@ namespace OpenSim.Framework.Communications
return null; return null;
} }
public void ResetAttachments(LLUUID userID)
{
foreach (IUserDataPlugin plugin in _plugins)
{
plugin.ResetAttachments(userID);
}
}
public UserAgentData GetAgentByUUID(LLUUID userId) public UserAgentData GetAgentByUUID(LLUUID userId)
{ {
foreach (IUserDataPlugin plugin in _plugins) foreach (IUserDataPlugin plugin in _plugins)
@ -639,51 +646,5 @@ namespace OpenSim.Framework.Communications
} }
} }
} }
public void AddAttachment(LLUUID user, LLUUID item)
{
foreach (IUserDataPlugin plugin in _plugins)
{
try
{
plugin.AddAttachment(user, item);
}
catch (Exception e)
{
m_log.InfoFormat("[USERSTORAGE]: Unable to attach {3} => {0} via {1} ({2})", user.ToString(), plugin.Name, e.ToString(), item.ToString());
}
}
}
public void RemoveAttachment(LLUUID user, LLUUID item)
{
foreach (IUserDataPlugin plugin in _plugins)
{
try
{
plugin.RemoveAttachment(user, item);
}
catch (Exception e)
{
m_log.InfoFormat("[USERSTORAGE]: Unable to remove attachment {3} => {0} via {1} ({2})", user.ToString(), plugin.Name, e.ToString(), item.ToString());
}
}
}
public List<LLUUID> GetAttachments(LLUUID user)
{
foreach (IUserDataPlugin plugin in _plugins)
{
try
{
return plugin.GetAttachments(user);
}
catch (Exception e)
{
m_log.InfoFormat("[USERSTORAGE]: Unable to get attachments for {0} via {1} ({2})", user.ToString(), plugin.Name, e.ToString());
}
}
return new List<LLUUID>();
}
} }
} }

View File

@ -165,10 +165,7 @@ namespace OpenSim.Framework
void UpdateUserAppearance(LLUUID user, AvatarAppearance appearance); void UpdateUserAppearance(LLUUID user, AvatarAppearance appearance);
void ResetAttachments(LLUUID userID);
void AddAttachment(LLUUID user, LLUUID item);
void RemoveAttachment(LLUUID user, LLUUID item);
List<LLUUID> GetAttachments(LLUUID user);
} }
public class UserDataInitialiser : PluginInitialiserBase public class UserDataInitialiser : PluginInitialiserBase

View File

@ -2880,24 +2880,33 @@ namespace OpenSim.Region.Environment.Scenes
if (attachpoint == 0) if (attachpoint == 0)
return; return;
LLUUID asset = m_appearance.GetAttachedAsset(attachpoint);
if (asset == LLUUID.Zero) // We have just logged in
{
m_log.InfoFormat("[ATTACHMENT] Rez attachment {0}",
itemID.ToString());
// Rez from inventory
m_scene.RezSingleAttachment(ControllingClient, itemID,
(uint)attachpoint, 0, 0);
return;
}
SceneObjectPart att = m_scene.GetSceneObjectPart(m_appearance.GetAttachedAsset(attachpoint)); SceneObjectPart att = m_scene.GetSceneObjectPart(m_appearance.GetAttachedAsset(attachpoint));
// If this is null, then we have just rezzed in. Non null means // If this is null, then the asset has not yet appeared in world
// we're crossing // so we revisit this when it does
// //
if (att != null) if (att != null)
{ {
System.Console.WriteLine("Attach from world {0}", itemID.ToString()); m_log.InfoFormat("[ATTACHEMENT] Attach from world {0}",
itemID.ToString());
// Attach from world // Attach from world
if (att.ParentGroup != null) if (att.ParentGroup != null)
m_scene.RezSingleAttachment(att.ParentGroup, ControllingClient, itemID, (uint)attachpoint, 0, 0); m_scene.RezSingleAttachment(att.ParentGroup,
} ControllingClient, itemID, (uint)attachpoint, 0, 0);
else
{
System.Console.WriteLine("Rez attachment {0}", itemID.ToString());
// Rez from inventory
m_scene.RezSingleAttachment(ControllingClient, itemID, (uint)attachpoint, 0, 0);
} }
} }
} }