diff --git a/OpenSim/Data/MSSQL/MSSQLUserData.cs b/OpenSim/Data/MSSQL/MSSQLUserData.cs index e63a9fe950..cfe5f5061b 100644 --- a/OpenSim/Data/MSSQL/MSSQLUserData.cs +++ b/OpenSim/Data/MSSQL/MSSQLUserData.cs @@ -892,37 +892,6 @@ namespace OpenSim.Data.MSSQL } } - /// - /// add an attachement to an avatar - /// - /// the avatar UUID - /// the item UUID - override public void AddAttachment(LLUUID user, LLUUID item) - { - // TBI? - } - - /// - /// Remove an attachement from an avatar - /// - /// the avatar UUID - /// the item UUID - override public void RemoveAttachment(LLUUID user, LLUUID item) - { - // TBI? - } - - /// - /// get (fetch?) all attached item to an avatar - /// - /// the avatar UUID - /// List of attached item - /// return an empty list - override public List GetAttachments(LLUUID user) - { - return new List(); - } - /// /// Database provider name /// @@ -948,5 +917,9 @@ namespace OpenSim.Data.MSSQL public void runQuery(string query) { } + + override public void ResetAttachments(LLUUID userID) + { + } } } diff --git a/OpenSim/Data/MySQL/MySQLUserData.cs b/OpenSim/Data/MySQL/MySQLUserData.cs index 9a056b21fa..caae677b9e 100644 --- a/OpenSim/Data/MySQL/MySQLUserData.cs +++ b/OpenSim/Data/MySQL/MySQLUserData.cs @@ -778,36 +778,6 @@ namespace OpenSim.Data.MySQL } } - /// - /// Adds an attachment item to a user - /// - /// the user UUID - /// the item UUID - override public void AddAttachment(LLUUID user, LLUUID item) - { - return; - } - - /// - /// Removes an attachment from a user - /// - /// the user UUID - /// the item UUID - override public void RemoveAttachment(LLUUID user, LLUUID item) - { - return; - } - - /// - /// Get the list of item attached to a user - /// - /// the user UUID - /// UUID list of attached item - override public List GetAttachments(LLUUID user) - { - return new List(); - } - /// /// Database provider name /// @@ -845,5 +815,14 @@ namespace OpenSim.Data.MySQL { 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(); + } } } diff --git a/OpenSim/Data/NHibernate/NHibernateUserData.cs b/OpenSim/Data/NHibernate/NHibernateUserData.cs index c776474940..8435762678 100644 --- a/OpenSim/Data/NHibernate/NHibernateUserData.cs +++ b/OpenSim/Data/NHibernate/NHibernateUserData.cs @@ -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 GetAttachments(LLUUID user) - { - return new List(); } public override string Name { diff --git a/OpenSim/Data/SQLite/SQLiteUserData.cs b/OpenSim/Data/SQLite/SQLiteUserData.cs index 08a97f0966..beff2a44e8 100644 --- a/OpenSim/Data/SQLite/SQLiteUserData.cs +++ b/OpenSim/Data/SQLite/SQLiteUserData.cs @@ -582,39 +582,6 @@ namespace OpenSim.Data.SQLite aplist[user] = appearance; } - /// - /// Add an attachment item to an avatar - /// - /// the user UUID - /// the item UUID - /// DO NOTHING ? - override public void AddAttachment(LLUUID user, LLUUID item) - { - return; - } - - /// - /// Remove an attachement item from an avatar - /// - /// the user UUID - /// the item UUID - /// DO NOTHING ? - override public void RemoveAttachment(LLUUID user, LLUUID item) - { - return; - } - - /// - /// Get list of attached item - /// - /// the user UUID - /// List of attached item - /// DO NOTHING ? - override public List GetAttachments(LLUUID user) - { - return new List(); - } - /// /// Returns the name of the storage provider /// @@ -1040,5 +1007,9 @@ namespace OpenSim.Data.SQLite // return true; } + + override public void ResetAttachments(LLUUID userID) + { + } } } diff --git a/OpenSim/Data/UserDataBase.cs b/OpenSim/Data/UserDataBase.cs index b984c100c6..e57c8f8da2 100644 --- a/OpenSim/Data/UserDataBase.cs +++ b/OpenSim/Data/UserDataBase.cs @@ -72,9 +72,7 @@ namespace OpenSim.Data // aplist[user] = appearance; // m_log.Info("[APPEARANCE] Setting appearance for " + user.ToString() + appearance.ToString()); // } - public abstract void AddAttachment(LLUUID user, LLUUID item); - public abstract void RemoveAttachment(LLUUID user, LLUUID item); - public abstract List GetAttachments(LLUUID user); + public abstract void ResetAttachments(LLUUID userID); public abstract string Version {get;} public abstract string Name {get;} diff --git a/OpenSim/Framework/Communications/LoginService.cs b/OpenSim/Framework/Communications/LoginService.cs index 40064d38ba..73fba1eb40 100644 --- a/OpenSim/Framework/Communications/LoginService.cs +++ b/OpenSim/Framework/Communications/LoginService.cs @@ -220,6 +220,9 @@ namespace OpenSim.Framework.Communications } // Otherwise... // Create a new agent session + + m_userManager.ResetAttachments(userProfile.ID); + CreateAgent(userProfile, request); try @@ -390,6 +393,9 @@ namespace OpenSim.Framework.Communications // Otherwise... // Create a new agent session + + m_userManager.ResetAttachments(userProfile.ID); + CreateAgent(userProfile, request); try diff --git a/OpenSim/Framework/Communications/UserManagerBase.cs b/OpenSim/Framework/Communications/UserManagerBase.cs index feeb666ea7..ef900ead84 100644 --- a/OpenSim/Framework/Communications/UserManagerBase.cs +++ b/OpenSim/Framework/Communications/UserManagerBase.cs @@ -83,6 +83,13 @@ namespace OpenSim.Framework.Communications return null; } + public void ResetAttachments(LLUUID userID) + { + foreach (IUserDataPlugin plugin in _plugins) + { + plugin.ResetAttachments(userID); + } + } public UserAgentData GetAgentByUUID(LLUUID userId) { 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 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(); - } } } diff --git a/OpenSim/Framework/IUserData.cs b/OpenSim/Framework/IUserData.cs index f74c0dbc35..ffde0026df 100644 --- a/OpenSim/Framework/IUserData.cs +++ b/OpenSim/Framework/IUserData.cs @@ -165,10 +165,7 @@ namespace OpenSim.Framework void UpdateUserAppearance(LLUUID user, AvatarAppearance appearance); - - void AddAttachment(LLUUID user, LLUUID item); - void RemoveAttachment(LLUUID user, LLUUID item); - List GetAttachments(LLUUID user); + void ResetAttachments(LLUUID userID); } public class UserDataInitialiser : PluginInitialiserBase diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index 706fd61d5c..4bc5d34146 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs @@ -2880,24 +2880,33 @@ namespace OpenSim.Region.Environment.Scenes if (attachpoint == 0) 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)); - // If this is null, then we have just rezzed in. Non null means - // we're crossing + // If this is null, then the asset has not yet appeared in world + // so we revisit this when it does // 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 if (att.ParentGroup != null) - 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); + m_scene.RezSingleAttachment(att.ParentGroup, + ControllingClient, itemID, (uint)attachpoint, 0, 0); } } }