diff --git a/OpenSim/Framework/Communications/CommunicationsManager.cs b/OpenSim/Framework/Communications/CommunicationsManager.cs index 4dff71fdb9..bc04009cab 100644 --- a/OpenSim/Framework/Communications/CommunicationsManager.cs +++ b/OpenSim/Framework/Communications/CommunicationsManager.cs @@ -45,41 +45,12 @@ namespace OpenSim.Framework.Communications { //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - protected Dictionary m_nameRequestCache = new Dictionary(); - - public IUserService UserService - { - get { return m_userService; } - } - protected IUserService m_userService; - - public IAvatarService AvatarService - { - get { return m_avatarService; } - } - protected IAvatarService m_avatarService; - - public IInterServiceInventoryServices InterServiceInventoryService - { - get { return m_interServiceInventoryService; } - } - protected IInterServiceInventoryServices m_interServiceInventoryService; - public NetworkServersInfo NetworkServersInfo { get { return m_networkServersInfo; } } protected NetworkServersInfo m_networkServersInfo; - /// - /// Interface to user service for administrating users. - /// - public IUserAdminService UserAdminService - { - get { return m_userAdminService; } - } - protected IUserAdminService m_userAdminService; - /// /// Constructor /// @@ -90,20 +61,5 @@ namespace OpenSim.Framework.Communications m_networkServersInfo = serversInfo; } - #region Packet Handlers - - public void UpdateAvatarPropertiesRequest(IClientAPI remote_client, UserProfileData UserProfile) - { - m_userService.UpdateUserProfile(UserProfile); - return; - } - - public List GenerateAgentPickerRequestResponse(UUID queryID, string query) - { - List pickerlist = m_userService.GenerateAgentPickerRequestResponse(queryID, query); - return pickerlist; - } - - #endregion } } diff --git a/OpenSim/Framework/Communications/UserManagerBase.cs b/OpenSim/Framework/Communications/UserManagerBase.cs index 4f0af0664d..caa9c1c306 100644 --- a/OpenSim/Framework/Communications/UserManagerBase.cs +++ b/OpenSim/Framework/Communications/UserManagerBase.cs @@ -686,25 +686,6 @@ namespace OpenSim.Framework.Communications } else { - // - // WARNING: This is a horrible hack - // The purpose here is to avoid touching the user server at this point. - // There are dragons there that I can't deal with right now. - // diva 06/09/09 - // - if (m_InventoryService != null) - { - // local service (standalone) - m_log.Debug("[USERSTORAGE]: using IInventoryService to create user's inventory"); - m_InventoryService.CreateUserInventory(userProf.ID); - } - else if (m_commsManager.InterServiceInventoryService != null) - { - // used by the user server - m_log.Debug("[USERSTORAGE]: using m_commsManager.InterServiceInventoryService to create user's inventory"); - m_commsManager.InterServiceInventoryService.CreateNewUserInventory(userProf.ID); - } - return userProf.ID; } } diff --git a/OpenSim/Grid/UserServer/UserServerCommsManager.cs b/OpenSim/Grid/UserServer/UserServerCommsManager.cs index 8ef693b0b2..7dc514cd08 100644 --- a/OpenSim/Grid/UserServer/UserServerCommsManager.cs +++ b/OpenSim/Grid/UserServer/UserServerCommsManager.cs @@ -34,7 +34,6 @@ namespace OpenSim.Grid.UserServer public UserServerCommsManager(IInterServiceInventoryServices interServiceInventoryService) : base(null, null) { - m_interServiceInventoryService = interServiceInventoryService; } } } diff --git a/OpenSim/Region/Communications/Hypergrid/HGCommunicationsGridMode.cs b/OpenSim/Region/Communications/Hypergrid/HGCommunicationsGridMode.cs index 3486c8b3f6..210647776e 100644 --- a/OpenSim/Region/Communications/Hypergrid/HGCommunicationsGridMode.cs +++ b/OpenSim/Region/Communications/Hypergrid/HGCommunicationsGridMode.cs @@ -52,8 +52,6 @@ namespace OpenSim.Region.Communications.Hypergrid userServices.AddPlugin(new TemporaryUserProfilePlugin()); userServices.AddPlugin(new HGUserDataPlugin(this, userServices)); - m_userService = userServices; - m_avatarService = userServices; } } } diff --git a/OpenSim/Region/Communications/Hypergrid/HGCommunicationsStandalone.cs b/OpenSim/Region/Communications/Hypergrid/HGCommunicationsStandalone.cs index d979a01b55..f75edca8eb 100644 --- a/OpenSim/Region/Communications/Hypergrid/HGCommunicationsStandalone.cs +++ b/OpenSim/Region/Communications/Hypergrid/HGCommunicationsStandalone.cs @@ -58,9 +58,6 @@ namespace OpenSim.Region.Communications.Hypergrid hgUserService.AddPlugin(new TemporaryUserProfilePlugin()); hgUserService.AddPlugin(new HGUserDataPlugin(this, hgUserService)); - m_userService = hgUserService; - m_userAdminService = hgUserService; - m_avatarService = hgUserService; } } } diff --git a/OpenSim/Region/Communications/Local/CommunicationsLocal.cs b/OpenSim/Region/Communications/Local/CommunicationsLocal.cs index 4f83fdbb3a..8e7717e5e2 100644 --- a/OpenSim/Region/Communications/Local/CommunicationsLocal.cs +++ b/OpenSim/Region/Communications/Local/CommunicationsLocal.cs @@ -48,9 +48,6 @@ namespace OpenSim.Region.Communications.Local serversInfo.DefaultHomeLocX, serversInfo.DefaultHomeLocY, this); lus.AddPlugin(new TemporaryUserProfilePlugin()); lus.AddPlugin(configSettings.StandaloneUserPlugin, configSettings.StandaloneUserSource); - m_userService = lus; - m_userAdminService = lus; - m_avatarService = lus; //LocalLoginService loginService = CreateLoginService(libraryRootFolder, inventoryService, userService, backendService); } diff --git a/OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs b/OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs index 111b7c03bd..ede5fdad8f 100644 --- a/OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs +++ b/OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs @@ -45,8 +45,6 @@ namespace OpenSim.Region.Communications.OGS1 userServices.AddPlugin(new TemporaryUserProfilePlugin()); userServices.AddPlugin(new OGS1UserDataPlugin(this)); - m_userService = userServices; - m_avatarService = (IAvatarService)m_userService; } } diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index 884e6a6bbf..2b3d56d049 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs @@ -154,9 +154,9 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory public void AvatarIsWearing(Object sender, AvatarWearingArgs e) { IClientAPI clientView = (IClientAPI)sender; - ScenePresence avatar = m_scene.GetScenePresence(clientView.AgentId); + ScenePresence sp = m_scene.GetScenePresence(clientView.AgentId); - if (avatar == null) + if (sp == null) { m_log.Error("[APPEARANCE]: Avatar is child agent, ignoring AvatarIsWearing event"); return; @@ -166,7 +166,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory if (!TryGetAvatarAppearance(clientView.AgentId, out avatAppearance)) { m_log.Warn("[APPEARANCE]: We didn't seem to find the appearance, falling back to ScenePresence"); - avatAppearance = avatar.Appearance; + avatAppearance = sp.Appearance; } //m_log.DebugFormat("[APPEARANCE]: Received wearables for {0}", clientView.Name); @@ -179,10 +179,11 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory } } - SetAppearanceAssets(avatar.UUID, ref avatAppearance); + SetAppearanceAssets(sp.UUID, ref avatAppearance); + AvatarData adata = new AvatarData(avatAppearance); + m_scene.AvatarService.SetAvatar(clientView.AgentId, adata); - m_scene.CommsManager.AvatarService.UpdateUserAppearance(clientView.AgentId, avatAppearance); - avatar.Appearance = avatAppearance; + sp.Appearance = avatAppearance; } public static void GetDefaultAvatarAppearance(out AvatarWearable[] wearables, out byte[] visualParams) @@ -193,7 +194,9 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory public void UpdateDatabase(UUID user, AvatarAppearance appearance) { - m_scene.CommsManager.AvatarService.UpdateUserAppearance(user, appearance); + AvatarData adata = new AvatarData(appearance); + m_scene.AvatarService.SetAvatar(user, adata); + } private static byte[] GetDefaultVisualParams() diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs index fbb766094f..bbb1938355 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs @@ -332,14 +332,16 @@ namespace OpenSim.Region.Framework.Scenes { //EventManager.TriggerAvatarPickerRequest(); - List AvatarResponses = new List(); - AvatarResponses = m_sceneGridService.GenerateAgentPickerRequestResponse(RequestID, query); + List accounts = UserAccountService.GetUserAccounts(RegionInfo.ScopeID, query); + + if (accounts == null) + return; AvatarPickerReplyPacket replyPacket = (AvatarPickerReplyPacket) PacketPool.Instance.GetPacket(PacketType.AvatarPickerReply); // TODO: don't create new blocks if recycling an old packet AvatarPickerReplyPacket.DataBlock[] searchData = - new AvatarPickerReplyPacket.DataBlock[AvatarResponses.Count]; + new AvatarPickerReplyPacket.DataBlock[accounts.Count]; AvatarPickerReplyPacket.AgentDataBlock agentData = new AvatarPickerReplyPacket.AgentDataBlock(); agentData.AgentID = avatarID; @@ -348,16 +350,16 @@ namespace OpenSim.Region.Framework.Scenes //byte[] bytes = new byte[AvatarResponses.Count*32]; int i = 0; - foreach (AvatarPickerAvatar item in AvatarResponses) + foreach (UserAccount item in accounts) { - UUID translatedIDtem = item.AvatarID; + UUID translatedIDtem = item.PrincipalID; searchData[i] = new AvatarPickerReplyPacket.DataBlock(); searchData[i].AvatarID = translatedIDtem; - searchData[i].FirstName = Utils.StringToBytes((string) item.firstName); - searchData[i].LastName = Utils.StringToBytes((string) item.lastName); + searchData[i].FirstName = Utils.StringToBytes((string) item.FirstName); + searchData[i].LastName = Utils.StringToBytes((string) item.LastName); i++; } - if (AvatarResponses.Count == 0) + if (accounts.Count == 0) { searchData = new AvatarPickerReplyPacket.DataBlock[0]; } diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs index 04ecb5f3a2..2e82748cad 100644 --- a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs +++ b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs @@ -1443,12 +1443,7 @@ namespace OpenSim.Region.Framework.Scenes //m_log.DebugFormat("[SCENE COMM]: Crossing agent {0} {1} completed.", agent.Firstname, agent.Lastname); } - - public List GenerateAgentPickerRequestResponse(UUID queryID, string query) - { - return m_commsProvider.GenerateAgentPickerRequestResponse(queryID, query); - } - + public List RequestNamedRegions(string name, int maxNumber) { return m_scene.GridService.GetRegionsByName(UUID.Zero, name, maxNumber); diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 97415f49e4..09b53d2af7 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -2573,7 +2573,8 @@ namespace OpenSim.Region.Framework.Scenes m_appearance.SetAppearance(textureEntry, visualParams); if (m_appearance.AvatarHeight > 0) SetHeight(m_appearance.AvatarHeight); - m_scene.CommsManager.AvatarService.UpdateUserAppearance(m_controllingClient.AgentId, m_appearance); + AvatarData adata = new AvatarData(m_appearance); + m_scene.AvatarService.SetAvatar(m_controllingClient.AgentId, adata); SendAppearanceToAllOtherAgents(); if (!m_startAnimationSet) @@ -2593,7 +2594,8 @@ namespace OpenSim.Region.Framework.Scenes public void SetWearable(int wearableId, AvatarWearable wearable) { m_appearance.SetWearable(wearableId, wearable); - m_scene.CommsManager.AvatarService.UpdateUserAppearance(m_controllingClient.AgentId, m_appearance); + AvatarData adata = new AvatarData(m_appearance); + m_scene.AvatarService.SetAvatar(m_controllingClient.AgentId, adata); m_controllingClient.SendWearables(m_appearance.Wearables, m_appearance.Serial++); } diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs index ac39a532ae..a6d4a933bf 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs @@ -34,6 +34,7 @@ using OpenSim.Region.Framework.Scenes; using OpenSim.Region.CoreModules.Avatar.NPC; using OpenSim.Framework; using Timer=System.Timers.Timer; +using OpenSim.Services.Interfaces; namespace OpenSim.Region.OptionalModules.World.NPC { @@ -63,11 +64,16 @@ namespace OpenSim.Region.OptionalModules.World.NPC if (m_appearanceCache.ContainsKey(target)) return m_appearanceCache[target]; - AvatarAppearance x = scene.CommsManager.AvatarService.GetUserAppearance(target); + AvatarData adata = scene.AvatarService.GetAvatar(target); + if (adata != null) + { + AvatarAppearance x = adata.ToAvatarAppearance(); - m_appearanceCache.Add(target, x); + m_appearanceCache.Add(target, x); - return x; + return x; + } + return new AvatarAppearance(); } public UUID CreateNPC(string firstname, string lastname,Vector3 position, Scene scene, UUID cloneAppearanceFrom) diff --git a/OpenSim/Tests/Common/Mock/TestCommunicationsManager.cs b/OpenSim/Tests/Common/Mock/TestCommunicationsManager.cs index 013462ebee..fccc2823c2 100644 --- a/OpenSim/Tests/Common/Mock/TestCommunicationsManager.cs +++ b/OpenSim/Tests/Common/Mock/TestCommunicationsManager.cs @@ -62,8 +62,6 @@ namespace OpenSim.Tests.Common.Mock lus.AddPlugin(new TemporaryUserProfilePlugin()); m_userDataPlugin = new TestUserDataPlugin(); lus.AddPlugin(m_userDataPlugin); - m_userService = lus; - m_userAdminService = lus; } }