diff options
author | Melanie Thielker | 2008-08-19 18:34:46 +0000 |
---|---|---|
committer | Melanie Thielker | 2008-08-19 18:34:46 +0000 |
commit | 41440e184b1c12f1b83d894b2cd5b7b801b4ca38 (patch) | |
tree | 1d3298ae47cc11f0167257a7aab7a45212b7a497 | |
parent | Moves one file to it's proper location (diff) | |
download | opensim-SC-41440e184b1c12f1b83d894b2cd5b7b801b4ca38.zip opensim-SC-41440e184b1c12f1b83d894b2cd5b7b801b4ca38.tar.gz opensim-SC-41440e184b1c12f1b83d894b2cd5b7b801b4ca38.tar.bz2 opensim-SC-41440e184b1c12f1b83d894b2cd5b7b801b4ca38.tar.xz |
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.
-rw-r--r-- | OpenSim/Data/MSSQL/MSSQLUserData.cs | 35 | ||||
-rw-r--r-- | OpenSim/Data/MySQL/MySQLUserData.cs | 39 | ||||
-rw-r--r-- | OpenSim/Data/NHibernate/NHibernateUserData.cs | 13 | ||||
-rw-r--r-- | OpenSim/Data/SQLite/SQLiteUserData.cs | 37 | ||||
-rw-r--r-- | OpenSim/Data/UserDataBase.cs | 4 | ||||
-rw-r--r-- | OpenSim/Framework/Communications/LoginService.cs | 6 | ||||
-rw-r--r-- | OpenSim/Framework/Communications/UserManagerBase.cs | 53 | ||||
-rw-r--r-- | OpenSim/Framework/IUserData.cs | 5 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/ScenePresence.cs | 29 |
9 files changed, 52 insertions, 169 deletions
diff --git a/OpenSim/Data/MSSQL/MSSQLUserData.cs b/OpenSim/Data/MSSQL/MSSQLUserData.cs index e63a9fe..cfe5f50 100644 --- a/OpenSim/Data/MSSQL/MSSQLUserData.cs +++ b/OpenSim/Data/MSSQL/MSSQLUserData.cs | |||
@@ -893,37 +893,6 @@ namespace OpenSim.Data.MSSQL | |||
893 | } | 893 | } |
894 | 894 | ||
895 | /// <summary> | 895 | /// <summary> |
896 | /// add an attachement to an avatar | ||
897 | /// </summary> | ||
898 | /// <param name="user">the avatar UUID</param> | ||
899 | /// <param name="item">the item UUID</param> | ||
900 | override public void AddAttachment(LLUUID user, LLUUID item) | ||
901 | { | ||
902 | // TBI? | ||
903 | } | ||
904 | |||
905 | /// <summary> | ||
906 | /// Remove an attachement from an avatar | ||
907 | /// </summary> | ||
908 | /// <param name="user">the avatar UUID</param> | ||
909 | /// <param name="item">the item UUID</param> | ||
910 | override public void RemoveAttachment(LLUUID user, LLUUID item) | ||
911 | { | ||
912 | // TBI? | ||
913 | } | ||
914 | |||
915 | /// <summary> | ||
916 | /// get (fetch?) all attached item to an avatar | ||
917 | /// </summary> | ||
918 | /// <param name="user">the avatar UUID</param> | ||
919 | /// <returns>List of attached item</returns> | ||
920 | /// <remarks>return an empty list</remarks> | ||
921 | override public List<LLUUID> GetAttachments(LLUUID user) | ||
922 | { | ||
923 | return new List<LLUUID>(); | ||
924 | } | ||
925 | |||
926 | /// <summary> | ||
927 | /// Database provider name | 896 | /// Database provider name |
928 | /// </summary> | 897 | /// </summary> |
929 | /// <returns>Provider name</returns> | 898 | /// <returns>Provider name</returns> |
@@ -948,5 +917,9 @@ namespace OpenSim.Data.MSSQL | |||
948 | public void runQuery(string query) | 917 | public void runQuery(string query) |
949 | { | 918 | { |
950 | } | 919 | } |
920 | |||
921 | override public void ResetAttachments(LLUUID userID) | ||
922 | { | ||
923 | } | ||
951 | } | 924 | } |
952 | } | 925 | } |
diff --git a/OpenSim/Data/MySQL/MySQLUserData.cs b/OpenSim/Data/MySQL/MySQLUserData.cs index 9a056b2..caae677 100644 --- a/OpenSim/Data/MySQL/MySQLUserData.cs +++ b/OpenSim/Data/MySQL/MySQLUserData.cs | |||
@@ -779,36 +779,6 @@ namespace OpenSim.Data.MySQL | |||
779 | } | 779 | } |
780 | 780 | ||
781 | /// <summary> | 781 | /// <summary> |
782 | /// Adds an attachment item to a user | ||
783 | /// </summary> | ||
784 | /// <param name="user">the user UUID</param> | ||
785 | /// <param name="item">the item UUID</param> | ||
786 | override public void AddAttachment(LLUUID user, LLUUID item) | ||
787 | { | ||
788 | return; | ||
789 | } | ||
790 | |||
791 | /// <summary> | ||
792 | /// Removes an attachment from a user | ||
793 | /// </summary> | ||
794 | /// <param name="user">the user UUID</param> | ||
795 | /// <param name="item">the item UUID</param> | ||
796 | override public void RemoveAttachment(LLUUID user, LLUUID item) | ||
797 | { | ||
798 | return; | ||
799 | } | ||
800 | |||
801 | /// <summary> | ||
802 | /// Get the list of item attached to a user | ||
803 | /// </summary> | ||
804 | /// <param name="user">the user UUID</param> | ||
805 | /// <returns>UUID list of attached item</returns> | ||
806 | override public List<LLUUID> GetAttachments(LLUUID user) | ||
807 | { | ||
808 | return new List<LLUUID>(); | ||
809 | } | ||
810 | |||
811 | /// <summary> | ||
812 | /// Database provider name | 782 | /// Database provider name |
813 | /// </summary> | 783 | /// </summary> |
814 | /// <returns>Provider name</returns> | 784 | /// <returns>Provider name</returns> |
@@ -845,5 +815,14 @@ namespace OpenSim.Data.MySQL | |||
845 | { | 815 | { |
846 | database.writeAttachments(agentID, data); | 816 | database.writeAttachments(agentID, data); |
847 | } | 817 | } |
818 | |||
819 | override public void ResetAttachments(LLUUID userID) | ||
820 | { | ||
821 | MySqlCommand cmd = (MySqlCommand) (database.Connection.CreateCommand()); | ||
822 | cmd.CommandText = "update avatarattachments set asset = '00000000-0000-0000-0000-000000000000' where UUID = ?uuid"; | ||
823 | cmd.Parameters.AddWithValue("?uuid", userID.ToString()); | ||
824 | |||
825 | cmd.ExecuteNonQuery(); | ||
826 | } | ||
848 | } | 827 | } |
849 | } | 828 | } |
diff --git a/OpenSim/Data/NHibernate/NHibernateUserData.cs b/OpenSim/Data/NHibernate/NHibernateUserData.cs index c776474..8435762 100644 --- a/OpenSim/Data/NHibernate/NHibernateUserData.cs +++ b/OpenSim/Data/NHibernate/NHibernateUserData.cs | |||
@@ -303,19 +303,8 @@ namespace OpenSim.Data.NHibernate | |||
303 | } | 303 | } |
304 | } | 304 | } |
305 | 305 | ||
306 | override public void AddAttachment(LLUUID user, LLUUID item) | 306 | public override void ResetAttachments(LLUUID userID) |
307 | { | 307 | { |
308 | return; | ||
309 | } | ||
310 | |||
311 | override public void RemoveAttachment(LLUUID user, LLUUID item) | ||
312 | { | ||
313 | return; | ||
314 | } | ||
315 | |||
316 | override public List<LLUUID> GetAttachments(LLUUID user) | ||
317 | { | ||
318 | return new List<LLUUID>(); | ||
319 | } | 308 | } |
320 | 309 | ||
321 | public override string Name { | 310 | public override string Name { |
diff --git a/OpenSim/Data/SQLite/SQLiteUserData.cs b/OpenSim/Data/SQLite/SQLiteUserData.cs index 08a97f09..beff2a4 100644 --- a/OpenSim/Data/SQLite/SQLiteUserData.cs +++ b/OpenSim/Data/SQLite/SQLiteUserData.cs | |||
@@ -583,39 +583,6 @@ namespace OpenSim.Data.SQLite | |||
583 | } | 583 | } |
584 | 584 | ||
585 | /// <summary> | 585 | /// <summary> |
586 | /// Add an attachment item to an avatar | ||
587 | /// </summary> | ||
588 | /// <param name="user">the user UUID</param> | ||
589 | /// <param name="item">the item UUID</param> | ||
590 | /// <remarks>DO NOTHING ?</remarks> | ||
591 | override public void AddAttachment(LLUUID user, LLUUID item) | ||
592 | { | ||
593 | return; | ||
594 | } | ||
595 | |||
596 | /// <summary> | ||
597 | /// Remove an attachement item from an avatar | ||
598 | /// </summary> | ||
599 | /// <param name="user">the user UUID</param> | ||
600 | /// <param name="item">the item UUID</param> | ||
601 | /// <remarks>DO NOTHING ?</remarks> | ||
602 | override public void RemoveAttachment(LLUUID user, LLUUID item) | ||
603 | { | ||
604 | return; | ||
605 | } | ||
606 | |||
607 | /// <summary> | ||
608 | /// Get list of attached item | ||
609 | /// </summary> | ||
610 | /// <param name="user">the user UUID</param> | ||
611 | /// <returns>List of attached item</returns> | ||
612 | /// <remarks>DO NOTHING ?</remarks> | ||
613 | override public List<LLUUID> GetAttachments(LLUUID user) | ||
614 | { | ||
615 | return new List<LLUUID>(); | ||
616 | } | ||
617 | |||
618 | /// <summary> | ||
619 | /// Returns the name of the storage provider | 586 | /// Returns the name of the storage provider |
620 | /// </summary> | 587 | /// </summary> |
621 | /// <returns>Storage provider name</returns> | 588 | /// <returns>Storage provider name</returns> |
@@ -1040,5 +1007,9 @@ namespace OpenSim.Data.SQLite | |||
1040 | 1007 | ||
1041 | // return true; | 1008 | // return true; |
1042 | } | 1009 | } |
1010 | |||
1011 | override public void ResetAttachments(LLUUID userID) | ||
1012 | { | ||
1013 | } | ||
1043 | } | 1014 | } |
1044 | } | 1015 | } |
diff --git a/OpenSim/Data/UserDataBase.cs b/OpenSim/Data/UserDataBase.cs index b984c10..e57c8f8 100644 --- a/OpenSim/Data/UserDataBase.cs +++ b/OpenSim/Data/UserDataBase.cs | |||
@@ -72,9 +72,7 @@ namespace OpenSim.Data | |||
72 | // aplist[user] = appearance; | 72 | // aplist[user] = appearance; |
73 | // m_log.Info("[APPEARANCE] Setting appearance for " + user.ToString() + appearance.ToString()); | 73 | // m_log.Info("[APPEARANCE] Setting appearance for " + user.ToString() + appearance.ToString()); |
74 | // } | 74 | // } |
75 | public abstract void AddAttachment(LLUUID user, LLUUID item); | 75 | public abstract void ResetAttachments(LLUUID userID); |
76 | public abstract void RemoveAttachment(LLUUID user, LLUUID item); | ||
77 | public abstract List<LLUUID> GetAttachments(LLUUID user); | ||
78 | 76 | ||
79 | public abstract string Version {get;} | 77 | public abstract string Version {get;} |
80 | public abstract string Name {get;} | 78 | public abstract string Name {get;} |
diff --git a/OpenSim/Framework/Communications/LoginService.cs b/OpenSim/Framework/Communications/LoginService.cs index 40064d3..73fba1e 100644 --- a/OpenSim/Framework/Communications/LoginService.cs +++ b/OpenSim/Framework/Communications/LoginService.cs | |||
@@ -220,6 +220,9 @@ namespace OpenSim.Framework.Communications | |||
220 | } | 220 | } |
221 | // Otherwise... | 221 | // Otherwise... |
222 | // Create a new agent session | 222 | // Create a new agent session |
223 | |||
224 | m_userManager.ResetAttachments(userProfile.ID); | ||
225 | |||
223 | CreateAgent(userProfile, request); | 226 | CreateAgent(userProfile, request); |
224 | 227 | ||
225 | try | 228 | try |
@@ -390,6 +393,9 @@ namespace OpenSim.Framework.Communications | |||
390 | 393 | ||
391 | // Otherwise... | 394 | // Otherwise... |
392 | // Create a new agent session | 395 | // Create a new agent session |
396 | |||
397 | m_userManager.ResetAttachments(userProfile.ID); | ||
398 | |||
393 | CreateAgent(userProfile, request); | 399 | CreateAgent(userProfile, request); |
394 | 400 | ||
395 | try | 401 | try |
diff --git a/OpenSim/Framework/Communications/UserManagerBase.cs b/OpenSim/Framework/Communications/UserManagerBase.cs index feeb666..ef900ea 100644 --- a/OpenSim/Framework/Communications/UserManagerBase.cs +++ b/OpenSim/Framework/Communications/UserManagerBase.cs | |||
@@ -83,6 +83,13 @@ namespace OpenSim.Framework.Communications | |||
83 | 83 | ||
84 | return null; | 84 | return null; |
85 | } | 85 | } |
86 | public void ResetAttachments(LLUUID userID) | ||
87 | { | ||
88 | foreach (IUserDataPlugin plugin in _plugins) | ||
89 | { | ||
90 | plugin.ResetAttachments(userID); | ||
91 | } | ||
92 | } | ||
86 | public UserAgentData GetAgentByUUID(LLUUID userId) | 93 | public UserAgentData GetAgentByUUID(LLUUID userId) |
87 | { | 94 | { |
88 | foreach (IUserDataPlugin plugin in _plugins) | 95 | foreach (IUserDataPlugin plugin in _plugins) |
@@ -639,51 +646,5 @@ namespace OpenSim.Framework.Communications | |||
639 | } | 646 | } |
640 | } | 647 | } |
641 | } | 648 | } |
642 | |||
643 | public void AddAttachment(LLUUID user, LLUUID item) | ||
644 | { | ||
645 | foreach (IUserDataPlugin plugin in _plugins) | ||
646 | { | ||
647 | try | ||
648 | { | ||
649 | plugin.AddAttachment(user, item); | ||
650 | } | ||
651 | catch (Exception e) | ||
652 | { | ||
653 | m_log.InfoFormat("[USERSTORAGE]: Unable to attach {3} => {0} via {1} ({2})", user.ToString(), plugin.Name, e.ToString(), item.ToString()); | ||
654 | } | ||
655 | } | ||
656 | } | ||
657 | |||
658 | public void RemoveAttachment(LLUUID user, LLUUID item) | ||
659 | { | ||
660 | foreach (IUserDataPlugin plugin in _plugins) | ||
661 | { | ||
662 | try | ||
663 | { | ||
664 | plugin.RemoveAttachment(user, item); | ||
665 | } | ||
666 | catch (Exception e) | ||
667 | { | ||
668 | m_log.InfoFormat("[USERSTORAGE]: Unable to remove attachment {3} => {0} via {1} ({2})", user.ToString(), plugin.Name, e.ToString(), item.ToString()); | ||
669 | } | ||
670 | } | ||
671 | } | ||
672 | |||
673 | public List<LLUUID> GetAttachments(LLUUID user) | ||
674 | { | ||
675 | foreach (IUserDataPlugin plugin in _plugins) | ||
676 | { | ||
677 | try | ||
678 | { | ||
679 | return plugin.GetAttachments(user); | ||
680 | } | ||
681 | catch (Exception e) | ||
682 | { | ||
683 | m_log.InfoFormat("[USERSTORAGE]: Unable to get attachments for {0} via {1} ({2})", user.ToString(), plugin.Name, e.ToString()); | ||
684 | } | ||
685 | } | ||
686 | return new List<LLUUID>(); | ||
687 | } | ||
688 | } | 649 | } |
689 | } | 650 | } |
diff --git a/OpenSim/Framework/IUserData.cs b/OpenSim/Framework/IUserData.cs index f74c0db..ffde002 100644 --- a/OpenSim/Framework/IUserData.cs +++ b/OpenSim/Framework/IUserData.cs | |||
@@ -165,10 +165,7 @@ namespace OpenSim.Framework | |||
165 | 165 | ||
166 | void UpdateUserAppearance(LLUUID user, AvatarAppearance appearance); | 166 | void UpdateUserAppearance(LLUUID user, AvatarAppearance appearance); |
167 | 167 | ||
168 | 168 | void ResetAttachments(LLUUID userID); | |
169 | void AddAttachment(LLUUID user, LLUUID item); | ||
170 | void RemoveAttachment(LLUUID user, LLUUID item); | ||
171 | List<LLUUID> GetAttachments(LLUUID user); | ||
172 | } | 169 | } |
173 | 170 | ||
174 | public class UserDataInitialiser : PluginInitialiserBase | 171 | public class UserDataInitialiser : PluginInitialiserBase |
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index 706fd61..4bc5d34 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs | |||
@@ -2880,24 +2880,33 @@ namespace OpenSim.Region.Environment.Scenes | |||
2880 | if (attachpoint == 0) | 2880 | if (attachpoint == 0) |
2881 | return; | 2881 | return; |
2882 | 2882 | ||
2883 | LLUUID asset = m_appearance.GetAttachedAsset(attachpoint); | ||
2884 | if (asset == LLUUID.Zero) // We have just logged in | ||
2885 | { | ||
2886 | m_log.InfoFormat("[ATTACHMENT] Rez attachment {0}", | ||
2887 | itemID.ToString()); | ||
2888 | |||
2889 | // Rez from inventory | ||
2890 | m_scene.RezSingleAttachment(ControllingClient, itemID, | ||
2891 | (uint)attachpoint, 0, 0); | ||
2892 | return; | ||
2893 | } | ||
2894 | |||
2883 | SceneObjectPart att = m_scene.GetSceneObjectPart(m_appearance.GetAttachedAsset(attachpoint)); | 2895 | SceneObjectPart att = m_scene.GetSceneObjectPart(m_appearance.GetAttachedAsset(attachpoint)); |
2884 | 2896 | ||
2885 | 2897 | ||
2886 | // If this is null, then we have just rezzed in. Non null means | 2898 | // If this is null, then the asset has not yet appeared in world |
2887 | // we're crossing | 2899 | // so we revisit this when it does |
2888 | // | 2900 | // |
2889 | if (att != null) | 2901 | if (att != null) |
2890 | { | 2902 | { |
2891 | System.Console.WriteLine("Attach from world {0}", itemID.ToString()); | 2903 | m_log.InfoFormat("[ATTACHEMENT] Attach from world {0}", |
2904 | itemID.ToString()); | ||
2905 | |||
2892 | // Attach from world | 2906 | // Attach from world |
2893 | if (att.ParentGroup != null) | 2907 | if (att.ParentGroup != null) |
2894 | m_scene.RezSingleAttachment(att.ParentGroup, ControllingClient, itemID, (uint)attachpoint, 0, 0); | 2908 | m_scene.RezSingleAttachment(att.ParentGroup, |
2895 | } | 2909 | ControllingClient, itemID, (uint)attachpoint, 0, 0); |
2896 | else | ||
2897 | { | ||
2898 | System.Console.WriteLine("Rez attachment {0}", itemID.ToString()); | ||
2899 | // Rez from inventory | ||
2900 | m_scene.RezSingleAttachment(ControllingClient, itemID, (uint)attachpoint, 0, 0); | ||
2901 | } | 2910 | } |
2902 | } | 2911 | } |
2903 | } | 2912 | } |