diff --git a/OpenSim/Framework/Communications/OspResolver.cs b/OpenSim/Framework/Communications/OspResolver.cs index 4627e305f9..924a4a9afd 100644 --- a/OpenSim/Framework/Communications/OspResolver.cs +++ b/OpenSim/Framework/Communications/OspResolver.cs @@ -104,6 +104,16 @@ namespace OpenSim.Framework.Communications return null; } + /// + /// Hash a profile name into a UUID + /// + /// + /// + public static UUID HashName(string name) + { + return new UUID(Utils.MD5(Encoding.Unicode.GetBytes(name)), 0); + } + /// /// Resolve an OSPI name by querying existing persistent user profiles. If there is no persistent user profile /// then a temporary user profile is inserted in the cache. @@ -133,7 +143,7 @@ namespace OpenSim.Framework.Communications UserProfileData tempUserProfile = new UserProfileData(); tempUserProfile.FirstName = firstName; tempUserProfile.SurName = lastName; - tempUserProfile.ID = new UUID(Utils.MD5(Encoding.Unicode.GetBytes(tempUserProfile.Name)), 0); + tempUserProfile.ID = HashName(tempUserProfile.Name); m_log.DebugFormat( "[OSP RESOLVER]: Adding temporary user profile for {0} {1}", tempUserProfile.Name, tempUserProfile.ID); diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs index d059632c96..214f49475b 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs @@ -311,7 +311,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests // Check that a suitable temporary user profile has been created. UserProfileData user2Profile = scene.CommsManager.UserService.GetUserProfile( - new UUID(Utils.MD5(Encoding.Unicode.GetBytes(user2FirstName + " " + user2LastName)), 0)); + OspResolver.HashName(user2FirstName + " " + user2LastName)); Assert.That(user2Profile, Is.Not.Null); Assert.That(user2Profile.FirstName == user2FirstName); Assert.That(user2Profile.SurName == user2LastName);