From 7bb005b0d1a5ae63ca94a3a3f8ad98e0388ea76b Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 16 Nov 2010 21:01:56 +0000 Subject: Change the way attachments are persisted. Editing a worn attachment will now save properly, as will the results of a resizer script working. Attachment positions are no longer saved on each move, but instead are saved once on logout. Attachment script states are saved as part of the attachment now when detaching. --- .../Framework/InventoryAccess/InventoryAccessModule.cs | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'OpenSim/Region/CoreModules/Framework') diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index 7a175ea..ef21834 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs @@ -569,12 +569,20 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess { group.RootPart.Flags |= PrimFlags.Phantom; group.RootPart.IsAttachment = true; - } - // If we're rezzing an attachment then don't ask AddNewSceneObject() to update the client since - // we'll be doing that later on. Scheduling more than one full update during the attachment - // process causes some clients to fail to display the attachment properly. - m_Scene.AddNewSceneObject(group, true, false); + // If we're rezzing an attachment then don't ask + // AddNewSceneObject() to update the client since + // we'll be doing that later on. Scheduling more + // than one full update during the attachment + // process causes some clients to fail to display + // the attachment properly. + // Also, don't persist attachments. + m_Scene.AddNewSceneObject(group, false, false); + } + else + { + m_Scene.AddNewSceneObject(group, true, false); + } // m_log.InfoFormat("ray end point for inventory rezz is {0} {1} {2} ", RayEnd.X, RayEnd.Y, RayEnd.Z); // if attachment we set it's asset id so object updates can reflect that -- cgit v1.1 From e6eeaaea6717f68c1ad622c4fbd308917b3d1408 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 17 Nov 2010 22:55:06 +0000 Subject: minor: add some method comments --- .../CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/CoreModules/Framework') diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index b5cab84..f02a922 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -1228,11 +1228,16 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer } m_log.Debug("[ENTITY TRANSFER MODULE]: Completed inform client about neighbour " + endPoint.ToString()); - } - } + /// + /// Return the list of regions that are considered to be neighbours to the given scene. + /// + /// + /// + /// + /// protected List RequestNeighbours(Scene pScene, uint pRegionLocX, uint pRegionLocY) { RegionInfo m_regionInfo = pScene.RegionInfo; -- cgit v1.1 From 6a9ae9e7cb71d79e9ec06cf25009e8bf45850dd1 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sun, 21 Nov 2010 13:16:52 -0800 Subject: Global creator information working on MySQL DB and on load/save OARs. Creator name properly shown on the viewer as first.last @authority. New option added to save oar -profile=url. Migration on RegionStore making CreatorID be 255 chars. Moved Handling of user UUID -> name requests to a new module UserManagement/UserManagementModule. --- .../UserManagement/UserManagementModule.cs | 297 +++++++++++++++++++++ 1 file changed, 297 insertions(+) create mode 100644 OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs (limited to 'OpenSim/Region/CoreModules/Framework') diff --git a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs new file mode 100644 index 0000000..88ed763 --- /dev/null +++ b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs @@ -0,0 +1,297 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +using System; +using System.Collections.Generic; +using System.IO; +using System.Reflection; + +using OpenSim.Framework; + +using OpenSim.Region.Framework; +using OpenSim.Region.Framework.Interfaces; +using OpenSim.Region.Framework.Scenes; +using OpenSim.Services.Interfaces; + +using OpenMetaverse; +using log4net; +using Nini.Config; + +namespace OpenSim.Region.CoreModules.Framework.UserManagement +{ + struct UserData + { + public UUID Id; + public string FirstName; + public string LastName; + public string ProfileURL; + } + + public class UserManagementModule : ISharedRegionModule, IUserManagement + { + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + + private List m_Scenes = new List(); + + // The cache + Dictionary m_UserCache = new Dictionary(); + + #region ISharedRegionModule + + public void Initialise(IConfigSource config) + { + //m_Enabled = config.Configs["Modules"].GetBoolean("LibraryModule", m_Enabled); + //if (m_Enabled) + //{ + // IConfig libConfig = config.Configs["LibraryService"]; + // if (libConfig != null) + // { + // string dllName = libConfig.GetString("LocalServiceModule", string.Empty); + // m_log.Debug("[LIBRARY MODULE]: Library service dll is " + dllName); + // if (dllName != string.Empty) + // { + // Object[] args = new Object[] { config }; + // m_Library = ServerUtils.LoadPlugin(dllName, args); + // } + // } + //} + } + + public bool IsSharedModule + { + get { return true; } + } + + public string Name + { + get { return "UserManagement Module"; } + } + + public Type ReplaceableInterface + { + get { return null; } + } + + public void AddRegion(Scene scene) + { + m_Scenes.Add(scene); + + scene.RegisterModuleInterface(this); + scene.EventManager.OnNewClient += new EventManager.OnNewClientDelegate(EventManager_OnNewClient); + } + + public void RemoveRegion(Scene scene) + { + scene.UnregisterModuleInterface(this); + m_Scenes.Remove(scene); + } + + public void RegionLoaded(Scene scene) + { + } + + public void PostInitialise() + { + foreach (Scene s in m_Scenes) + { + // let's sniff all the user names referenced by objects in the scene + m_log.DebugFormat("[USER MANAGEMENT MODULE]: Caching creators' data from {0} ({1} objects)...", s.RegionInfo.RegionName, s.GetEntities().Length); + s.ForEachSOG(delegate(SceneObjectGroup sog) { CacheCreators(sog); }); + } + } + + public void Close() + { + m_Scenes.Clear(); + m_UserCache.Clear(); + } + + #endregion ISharedRegionModule + + + #region Event Handlers + + void EventManager_OnNewClient(IClientAPI client) + { + client.OnNameFromUUIDRequest += new UUIDNameRequest(HandleUUIDNameRequest); + } + + void HandleUUIDNameRequest(UUID uuid, IClientAPI remote_client) + { + if (m_Scenes[0].LibraryService != null && (m_Scenes[0].LibraryService.LibraryRootFolder.Owner == uuid)) + { + remote_client.SendNameReply(uuid, "Mr", "OpenSim"); + } + else + { + string[] names = GetUserNames(uuid); + if (names.Length == 2) + { + remote_client.SendNameReply(uuid, names[0], names[1]); + } + + } + } + + #endregion Event Handlers + + private void CacheCreators(SceneObjectGroup sog) + { + //m_log.DebugFormat("[USER MANAGEMENT MODULE]: processing {0} {1}; {2}", sog.RootPart.Name, sog.RootPart.CreatorData, sog.RootPart.CreatorIdentification); + AddUser(sog.RootPart.CreatorID, sog.RootPart.CreatorData); + + foreach (SceneObjectPart sop in sog.Parts) + AddUser(sop.CreatorID, sop.CreatorData); + } + + + private string[] GetUserNames(UUID uuid) + { + string[] returnstring = new string[2]; + + if (m_UserCache.ContainsKey(uuid)) + { + returnstring[0] = m_UserCache[uuid].FirstName; + returnstring[1] = m_UserCache[uuid].LastName; + return returnstring; + } + + UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, uuid); + + if (account != null) + { + returnstring[0] = account.FirstName; + returnstring[1] = account.LastName; + + UserData user = new UserData(); + user.FirstName = account.FirstName; + user.LastName = account.LastName; + + lock (m_UserCache) + m_UserCache[uuid] = user; + } + else + { + returnstring[0] = "Unknown"; + returnstring[1] = "User"; + } + + return returnstring; + } + + #region IUserManagement + + public string GetUserName(UUID uuid) + { + string[] names = GetUserNames(uuid); + if (names.Length == 2) + { + string firstname = names[0]; + string lastname = names[1]; + + return firstname + " " + lastname; + + } + return "(hippos)"; + } + + public void AddUser(UUID id, string creatorData) + { + if (m_UserCache.ContainsKey(id)) + return; + + UserData user = new UserData(); + user.Id = id; + + if (creatorData != null && creatorData != string.Empty) + { + //creatorData = ; + + string[] parts = creatorData.Split(';'); + if (parts.Length >= 1) + { + user.ProfileURL = parts[0]; + try + { + Uri uri = new Uri(parts[0]); + user.LastName = "@" + uri.Authority; + } + catch + { + m_log.DebugFormat("[SCENE]: Unable to parse Uri {0}", parts[0]); + user.LastName = "@unknown"; + } + } + if (parts.Length >= 2) + user.FirstName = parts[1].Replace(' ', '.'); + } + else + { + UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, id); + user.FirstName = account.FirstName; + user.LastName = account.LastName; + // user.ProfileURL = we should initialize this to the default + } + + lock (m_UserCache) + m_UserCache[id] = user; + + //m_log.DebugFormat("[USER MANAGEMENT MODULE]: Added user {0} {1} {2} {3}", user.Id, user.FirstName, user.LastName, user.ProfileURL); + } + + //public void AddUser(UUID uuid, string userData) + //{ + // if (m_UserCache.ContainsKey(uuid)) + // return; + + // UserData user = new UserData(); + // user.Id = uuid; + + // // userData = ; + // string[] parts = userData.Split(';'); + // if (parts.Length >= 1) + // user.ProfileURL = parts[0].Trim(); + // if (parts.Length >= 2) + // { + // string[] name = parts[1].Trim().Split(' '); + // if (name.Length >= 1) + // user.FirstName = name[0]; + // if (name.Length >= 2) + // user.LastName = name[1]; + // else + // user.LastName = "?"; + // } + + // lock (m_UserCache) + // m_UserCache.Add(uuid, user); + + // m_log.DebugFormat("[USER MANAGEMENT MODULE]: Added user {0} {1} {2} {3}", user.Id, user.FirstName, user.LastName, user.ProfileURL); + + //} + + #endregion IUserManagement + } +} -- cgit v1.1 From c617d658dda92ad97de678d477a98c3df0659303 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sun, 21 Nov 2010 17:19:24 -0800 Subject: Added creator info across the board -- TaskInventoryItems and InventoryItems themselves. Tested. Seems to be working, main tests pass. Nothing done for IARs or HG transfers yet -- this only works for OARs for the time being. New migration in inventory table in order to make CreatorID varchar(255). --- .../InventoryAccess/InventoryAccessModule.cs | 1 + .../UserManagement/UserManagementModule.cs | 61 +++++++++++++--------- 2 files changed, 38 insertions(+), 24 deletions(-) (limited to 'OpenSim/Region/CoreModules/Framework') diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index ef21834..67732ff 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs @@ -370,6 +370,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess item = new InventoryItemBase(); item.CreatorId = objectGroup.RootPart.CreatorID.ToString(); + item.CreatorData = objectGroup.RootPart.CreatorData; item.ID = UUID.Random(); item.InvType = (int)InventoryType.Object; item.Folder = folder.ID; diff --git a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs index 88ed763..0d94baa 100644 --- a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs +++ b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs @@ -164,7 +164,11 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement AddUser(sog.RootPart.CreatorID, sog.RootPart.CreatorData); foreach (SceneObjectPart sop in sog.Parts) + { AddUser(sop.CreatorID, sop.CreatorData); + foreach (TaskInventoryItem item in sop.TaskInventory.Values) + AddUser(item.CreatorID, item.CreatorData); + } } @@ -226,40 +230,49 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement UserData user = new UserData(); user.Id = id; - if (creatorData != null && creatorData != string.Empty) - { - //creatorData = ; + UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, id); - string[] parts = creatorData.Split(';'); - if (parts.Length >= 1) - { - user.ProfileURL = parts[0]; - try - { - Uri uri = new Uri(parts[0]); - user.LastName = "@" + uri.Authority; - } - catch - { - m_log.DebugFormat("[SCENE]: Unable to parse Uri {0}", parts[0]); - user.LastName = "@unknown"; - } - } - if (parts.Length >= 2) - user.FirstName = parts[1].Replace(' ', '.'); - } - else + if (account != null) { - UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, id); user.FirstName = account.FirstName; user.LastName = account.LastName; // user.ProfileURL = we should initialize this to the default } + else + { + if (creatorData != null && creatorData != string.Empty) + { + //creatorData = ; + + string[] parts = creatorData.Split(';'); + if (parts.Length >= 1) + { + user.ProfileURL = parts[0]; + try + { + Uri uri = new Uri(parts[0]); + user.LastName = "@" + uri.Authority; + } + catch + { + m_log.DebugFormat("[SCENE]: Unable to parse Uri {0}", parts[0]); + user.LastName = "@unknown"; + } + } + if (parts.Length >= 2) + user.FirstName = parts[1].Replace(' ', '.'); + } + else + { + user.FirstName = "Unknown"; + user.LastName = "User"; + } + } lock (m_UserCache) m_UserCache[id] = user; - //m_log.DebugFormat("[USER MANAGEMENT MODULE]: Added user {0} {1} {2} {3}", user.Id, user.FirstName, user.LastName, user.ProfileURL); + m_log.DebugFormat("[USER MANAGEMENT MODULE]: Added user {0} {1} {2} {3}", user.Id, user.FirstName, user.LastName, user.ProfileURL); } //public void AddUser(UUID uuid, string userData) -- cgit v1.1