From f7b28dd32155eac2d55ccf0757b059794d6b5f67 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 7 Sep 2010 03:41:29 +0100 Subject: If a scene object part UUID is changed (only possible when not in a scene), then adjust the inventory items to point to the new uuid as well --- OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/CoreModules') diff --git a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs index 58698ee..32b3724 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs @@ -215,7 +215,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests public void TestLoadOarV0_2() { TestHelper.InMethod(); - //log4net.Config.XmlConfigurator.Configure(); +// log4net.Config.XmlConfigurator.Configure(); MemoryStream archiveWriteStream = new MemoryStream(); TarArchiveWriter tar = new TarArchiveWriter(archiveWriteStream); -- cgit v1.1 From 9be1c0ff448d4ea650ca921937905653b4017d61 Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Tue, 7 Sep 2010 14:41:13 -0700 Subject: * Cache null account responses in the SimianUserAccountServiceConnector to avoid repeated requests for missing avatar IDs * Updated to OpenMetaverse r3442 to fix a timezone issue with ExpiringCache --- OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs | 2 +- .../ServiceConnectorsOut/UserAccounts/UserAccountCache.cs | 6 ++++-- OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs | 5 ++++- 3 files changed, 9 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/CoreModules') diff --git a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs index 9eaa758..5255d30 100644 --- a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs +++ b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs @@ -252,7 +252,7 @@ namespace Flotsam.RegionModules.AssetCache } else { - m_MemoryCache.AddOrUpdate(key, asset, DateTime.MaxValue); + m_MemoryCache.AddOrUpdate(key, asset, Double.MaxValue); } } } diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs index e1bc243..e7cfda1 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs @@ -36,6 +36,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts { public class UserAccountCache { + private const double CACHE_EXPIRATION_SECONDS = 120.0; + private static readonly ILog m_log = LogManager.GetLogger( MethodBase.GetCurrentMethod().DeclaringType); @@ -51,9 +53,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts public void Cache(UUID userID, UserAccount account) { // Cache even null accounts - m_UUIDCache.AddOrUpdate(userID, account, DateTime.Now + TimeSpan.FromMinutes(2.0d)); + m_UUIDCache.AddOrUpdate(userID, account, CACHE_EXPIRATION_SECONDS); if (account != null) - m_NameCache.AddOrUpdate(account.Name, account.PrincipalID, DateTime.Now + TimeSpan.FromMinutes(2.0d)); + m_NameCache.AddOrUpdate(account.Name, account.PrincipalID, CACHE_EXPIRATION_SECONDS); m_log.DebugFormat("[USER CACHE]: cached user {0}", userID); } diff --git a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs index 58698ee..0f08408 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs @@ -48,6 +48,7 @@ using OpenSim.Tests.Common.Setup; using ArchiveConstants = OpenSim.Framework.Serialization.ArchiveConstants; using TarArchiveReader = OpenSim.Framework.Serialization.TarArchiveReader; using TarArchiveWriter = OpenSim.Framework.Serialization.TarArchiveWriter; +using RegionSettings = OpenSim.Framework.RegionSettings; namespace OpenSim.Region.CoreModules.World.Archiver.Tests { @@ -135,7 +136,9 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests SceneObjectPart part2 = CreateSceneObjectPart2(); - AssetNotecard nc = new AssetNotecard("Hello World!"); + AssetNotecard nc = new AssetNotecard(); + nc.BodyText = "Hello World!"; + nc.Encode(); UUID ncAssetUuid = new UUID("00000000-0000-0000-1000-000000000000"); UUID ncItemUuid = new UUID("00000000-0000-0000-1100-000000000000"); AssetBase ncAsset -- cgit v1.1 From 0bebe94231c3b5aeaa24a0eeb38272a08b73473b Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Tue, 7 Sep 2010 15:45:33 -0700 Subject: Rolling back the recent libomv update but keeping the ExpiringCache cleanups (as much as is possible). There was a report of non-finite avatar positions after the update --- OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs | 2 +- .../CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/CoreModules') diff --git a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs index 5255d30..9eaa758 100644 --- a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs +++ b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs @@ -252,7 +252,7 @@ namespace Flotsam.RegionModules.AssetCache } else { - m_MemoryCache.AddOrUpdate(key, asset, Double.MaxValue); + m_MemoryCache.AddOrUpdate(key, asset, DateTime.MaxValue); } } } diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs index e7cfda1..7c12b8c 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs @@ -53,9 +53,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts public void Cache(UUID userID, UserAccount account) { // Cache even null accounts - m_UUIDCache.AddOrUpdate(userID, account, CACHE_EXPIRATION_SECONDS); + m_UUIDCache.AddOrUpdate(userID, account, DateTime.Now + TimeSpan.FromSeconds(CACHE_EXPIRATION_SECONDS)); if (account != null) - m_NameCache.AddOrUpdate(account.Name, account.PrincipalID, CACHE_EXPIRATION_SECONDS); + m_NameCache.AddOrUpdate(account.Name, account.PrincipalID, DateTime.Now + TimeSpan.FromSeconds(CACHE_EXPIRATION_SECONDS)); m_log.DebugFormat("[USER CACHE]: cached user {0}", userID); } -- cgit v1.1 From d301f3fd6ad65e3eb39cfaff65cd3fbb896fa5c1 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Wed, 8 Sep 2010 14:12:01 -0700 Subject: Renamed the Helo server connector to a consistent name. Added this in connector to both Robust.HG.ini.example and HypergridServiceInConnectorModule. --- .../ServiceConnectorsIn/Hypergrid/HypergridServiceInConnectorModule.cs | 1 + 1 file changed, 1 insertion(+) (limited to 'OpenSim/Region/CoreModules') diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Hypergrid/HypergridServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Hypergrid/HypergridServiceInConnectorModule.cs index 235914a..2f96bcb 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Hypergrid/HypergridServiceInConnectorModule.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Hypergrid/HypergridServiceInConnectorModule.cs @@ -115,6 +115,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Hypergrid m_HypergridHandler = new GatekeeperServiceInConnector(m_Config, MainServer.Instance, simService); new UserAgentServerConnector(m_Config, MainServer.Instance); + new HeloServiceInConnector(m_Config, MainServer.Instance, "HeloService"); } scene.RegisterModuleInterface(m_HypergridHandler.GateKeeper); } -- cgit v1.1 From ae6682036df0268b47a27756915c72367663efec Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Wed, 8 Sep 2010 14:13:01 -0700 Subject: Made the HG asset and inventory brokers use the Helo service in order to instantiate the right network connectors. Tested on Robust only. --- .../ServiceConnectorsOut/Inventory/HGInventoryBroker.cs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'OpenSim/Region/CoreModules') diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs index 5b4fecb..39410b5 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs @@ -37,6 +37,7 @@ using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; using OpenSim.Services.Interfaces; using OpenSim.Services.Connectors; +using OpenSim.Services.Connectors.SimianGrid; using OpenMetaverse; namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory @@ -538,12 +539,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory } else { - // We're instantiating this class explicitly, but this won't - // work in general, because the remote grid may be running - // an inventory server that has a different protocol. - // Eventually we will want a piece of protocol asking - // the remote server about its kind. Definitely cool thing to do! - connector = new RemoteXInventoryServicesConnector(url); + // Still not as flexible as I would like this to be, + // but good enough for now + string connectorType = new HeloServicesConnector(url).Helo(); + m_log.DebugFormat("[HG INVENTORY SERVICE]: HELO returned {0}", connectorType); + if (connectorType == "opensim-simian") + connector = new SimianInventoryServiceConnector(url); + else + connector = new RemoteXInventoryServicesConnector(url); m_connectors.Add(url, connector); } } -- cgit v1.1 From 5dc9ea2f2487804d788b4b80d40d91bd792de4c2 Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Wed, 8 Sep 2010 15:08:49 -0700 Subject: * Changed 11 calls for session info to the more optimized API method --- .../CoreModules/Avatar/Friends/FriendsModule.cs | 100 +++++++-------------- .../Avatar/InstantMessage/MessageTransferModule.cs | 4 +- 2 files changed, 33 insertions(+), 71 deletions(-) (limited to 'OpenSim/Region/CoreModules') diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs index 6f044cb..1c1ba2d 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs @@ -348,10 +348,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(client.Scene.RegionInfo.ScopeID, new UUID(im.fromAgentID)); im.fromAgentName = account.FirstName + " " + account.LastName; - PresenceInfo presence = null; - PresenceInfo[] presences = PresenceService.GetAgents(new string[] { fid }); - if (presences != null && presences.Length > 0) - presence = presences[0]; + PresenceInfo presence = PresenceService.GetAgent(new UUID(im.fromAgentID)); if (presence != null) im.offline = 0; @@ -470,26 +467,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends return; // The friend is not here [as root]. Let's forward. - PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() }); - if (friendSessions != null && friendSessions.Length > 0) + PresenceInfo friendSession = PresenceService.GetAgent(friendID); + if (friendSession != null && friendSession.RegionID != UUID.Zero) // let's guard against sessions-gone-bad with the RegionID check { - PresenceInfo friendSession = null; - foreach (PresenceInfo pinfo in friendSessions) - if (pinfo.RegionID != UUID.Zero) // let's guard against sessions-gone-bad - { - friendSession = pinfo; - break; - } - - if (friendSession != null) - { - GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); - //m_log.DebugFormat("[FRIENDS]: Remote Notify to region {0}", region.RegionName); - m_FriendsSimConnector.StatusNotify(region, userID, friendID, online); - } + GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); + //m_log.DebugFormat("[FRIENDS]: Remote Notify to region {0}", region.RegionName); + m_FriendsSimConnector.StatusNotify(region, userID, friendID, online); } - - // Friend is not online. Ignore. } else m_log.WarnFormat("[FRIENDS]: Error parsing friend ID {0}", friend.Friend); @@ -528,15 +512,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends return; // The prospective friend is not here [as root]. Let's forward. - PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() }); - if (friendSessions != null && friendSessions.Length > 0) + PresenceInfo friendSession = PresenceService.GetAgent(friendID); + if (friendSession != null) { - PresenceInfo friendSession = friendSessions[0]; - if (friendSession != null) - { - GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); - m_FriendsSimConnector.FriendshipOffered(region, agentID, friendID, im.message); - } + GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); + m_FriendsSimConnector.FriendshipOffered(region, agentID, friendID, im.message); } // If the prospective friend is not online, he'll get the message upon login. } @@ -563,16 +543,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends } // The friend is not here - PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() }); - if (friendSessions != null && friendSessions.Length > 0) + PresenceInfo friendSession = PresenceService.GetAgent(friendID); + if (friendSession != null) { - PresenceInfo friendSession = friendSessions[0]; - if (friendSession != null) - { - GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); - m_FriendsSimConnector.FriendshipApproved(region, agentID, client.Name, friendID); - client.SendAgentOnline(new UUID[] { friendID }); - } + GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); + m_FriendsSimConnector.FriendshipApproved(region, agentID, client.Name, friendID); + client.SendAgentOnline(new UUID[] { friendID }); } } @@ -591,18 +567,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends if (LocalFriendshipDenied(agentID, client.Name, friendID)) return; - PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() }); - if (friendSessions != null && friendSessions.Length > 0) + PresenceInfo friendSession = PresenceService.GetAgent(friendID); + if (friendSession != null) { - PresenceInfo friendSession = friendSessions[0]; - if (friendSession != null) - { - GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); - if (region != null) - m_FriendsSimConnector.FriendshipDenied(region, agentID, client.Name, friendID); - else - m_log.WarnFormat("[FRIENDS]: Could not find region {0} in locating {1}", friendSession.RegionID, friendID); - } + GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); + if (region != null) + m_FriendsSimConnector.FriendshipDenied(region, agentID, client.Name, friendID); + else + m_log.WarnFormat("[FRIENDS]: Could not find region {0} in locating {1}", friendSession.RegionID, friendID); } } @@ -624,15 +596,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends if (LocalFriendshipTerminated(exfriendID)) return; - PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { exfriendID.ToString() }); - if (friendSessions != null && friendSessions.Length > 0) + PresenceInfo friendSession = PresenceService.GetAgent(exfriendID); + if (friendSession != null) { - PresenceInfo friendSession = friendSessions[0]; - if (friendSession != null) - { - GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); - m_FriendsSimConnector.FriendshipTerminated(region, agentID, exfriendID); - } + GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); + m_FriendsSimConnector.FriendshipTerminated(region, agentID, exfriendID); } } @@ -669,17 +637,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends if (LocalGrantRights(requester, target, myFlags, rights)) return; - PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { target.ToString() }); - if (friendSessions != null && friendSessions.Length > 0) + PresenceInfo friendSession = PresenceService.GetAgent(target); + if (friendSession != null) { - PresenceInfo friendSession = friendSessions[0]; - if (friendSession != null) - { - GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); - // TODO: You might want to send the delta to save the lookup - // on the other end!! - m_FriendsSimConnector.GrantRights(region, requester, target, myFlags, rights); - } + GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); + // TODO: You might want to send the delta to save the lookup + // on the other end!! + m_FriendsSimConnector.GrantRights(region, requester, target, myFlags, rights); } } } diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs index 730cc77..13bae2e 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs @@ -498,9 +498,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage if (lookupAgent) { // Non-cached user agent lookup. - PresenceInfo[] presences = PresenceService.GetAgents(new string[] { toAgentID.ToString() }); - if (presences != null && presences.Length > 0) - upd = presences[0]; + upd = PresenceService.GetAgent(toAgentID); if (upd != null) { -- cgit v1.1 From 8415b988063234ab7686b873520708891bca50a6 Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Thu, 9 Sep 2010 14:45:10 -0700 Subject: Over a dozen thread safety fixes in FriendsModule --- .../CoreModules/Avatar/Friends/FriendsModule.cs | 330 ++++++++++----------- 1 file changed, 163 insertions(+), 167 deletions(-) (limited to 'OpenSim/Region/CoreModules') diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs index 1c1ba2d..4e4eee9 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs @@ -54,7 +54,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends public UUID PrincipalID; public FriendInfo[] Friends; public int Refcount; - public UUID RegionID; public bool IsFriend(string friend) { @@ -67,7 +66,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends return false; } } - + + private static readonly FriendInfo[] EMPTY_FRIENDS = new FriendInfo[0]; private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); protected List m_Scenes = new List(); @@ -79,7 +79,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends protected Dictionary m_Friends = new Dictionary(); - protected List m_NeedsListOfFriends = new List(); + protected HashSet m_NeedsListOfFriends = new HashSet(); protected IPresenceService PresenceService { @@ -146,7 +146,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends // Instantiate the request handler IHttpServer server = MainServer.GetHttpServer((uint)mPort); server.AddStreamHandler(new FriendsRequestHandler(this)); - } if (m_FriendsService == null) @@ -173,7 +172,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends scene.EventManager.OnNewClient += OnNewClient; scene.EventManager.OnClientClosed += OnClientClosed; scene.EventManager.OnMakeRootAgent += OnMakeRootAgent; - scene.EventManager.OnMakeChildAgent += OnMakeChildAgent; scene.EventManager.OnClientLogin += OnClientLogin; } @@ -198,16 +196,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends public uint GetFriendPerms(UUID principalID, UUID friendID) { - if (!m_Friends.ContainsKey(principalID)) - return 0; - - UserFriendData data = m_Friends[principalID]; - - foreach (FriendInfo fi in data.Friends) + FriendInfo[] friends = GetFriends(principalID); + foreach (FriendInfo fi in friends) { if (fi.Friend == friendID.ToString()) return (uint)fi.TheirFlags; } + return 0; } @@ -217,73 +212,59 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends client.OnApproveFriendRequest += OnApproveFriendRequest; client.OnDenyFriendRequest += OnDenyFriendRequest; client.OnTerminateFriendship += OnTerminateFriendship; - client.OnGrantUserRights += OnGrantUserRights; - lock (m_Friends) - { - if (m_Friends.ContainsKey(client.AgentId)) + // Asynchronously fetch the friends list or increment the refcount for the existing + // friends list + Util.FireAndForget( + delegate(object o) { - m_Friends[client.AgentId].Refcount++; - return; - } - - UserFriendData newFriends = new UserFriendData(); - - newFriends.PrincipalID = client.AgentId; - newFriends.Friends = m_FriendsService.GetFriends(client.AgentId); - newFriends.Refcount = 1; - newFriends.RegionID = UUID.Zero; + lock (m_Friends) + { + UserFriendData friendsData; + if (m_Friends.TryGetValue(client.AgentId, out friendsData)) + { + friendsData.Refcount++; + } + else + { + friendsData = new UserFriendData(); + friendsData.PrincipalID = client.AgentId; + friendsData.Friends = FriendsService.GetFriends(client.AgentId); + friendsData.Refcount = 1; - m_Friends.Add(client.AgentId, newFriends); - } - + m_Friends[client.AgentId] = friendsData; + } + } + } + ); } private void OnClientClosed(UUID agentID, Scene scene) { ScenePresence sp = scene.GetScenePresence(agentID); if (sp != null && !sp.IsChildAgent) + { // do this for root agents closing out StatusChange(agentID, false); + } lock (m_Friends) - if (m_Friends.ContainsKey(agentID)) + { + UserFriendData friendsData; + if (m_Friends.TryGetValue(agentID, out friendsData)) { - if (m_Friends[agentID].Refcount == 1) + friendsData.Refcount--; + if (friendsData.Refcount <= 0) m_Friends.Remove(agentID); - else - m_Friends[agentID].Refcount--; } - } - - private void OnMakeRootAgent(ScenePresence sp) - { - UUID agentID = sp.ControllingClient.AgentId; - - if (m_Friends.ContainsKey(agentID)) - { - // This is probably an overkill, but just - // to make sure we have the latest and greatest - // friends list -- always pull OnMakeRoot - m_Friends[agentID].Friends = - m_FriendsService.GetFriends(agentID); - - m_Friends[agentID].RegionID = - sp.ControllingClient.Scene.RegionInfo.RegionID; } } - - private void OnMakeChildAgent(ScenePresence sp) + private void OnMakeRootAgent(ScenePresence sp) { UUID agentID = sp.ControllingClient.AgentId; - - if (m_Friends.ContainsKey(agentID)) - { - if (m_Friends[agentID].RegionID == sp.ControllingClient.Scene.RegionInfo.RegionID) - m_Friends[agentID].RegionID = UUID.Zero; - } + UpdateFriendsCache(agentID); } private void OnClientLogin(IClientAPI client) @@ -295,72 +276,56 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends // Register that we need to send the list of online friends to this user lock (m_NeedsListOfFriends) - if (!m_NeedsListOfFriends.Contains(agentID)) - { - m_NeedsListOfFriends.Add(agentID); - } + m_NeedsListOfFriends.Add(agentID); } public void SendFriendsOnlineIfNeeded(IClientAPI client) { UUID agentID = client.AgentId; - if (m_NeedsListOfFriends.Contains(agentID)) + + // Check if the online friends list is needed + lock (m_NeedsListOfFriends) { - if (!m_Friends.ContainsKey(agentID)) - { - m_log.DebugFormat("[FRIENDS MODULE]: agent {0} not found in local cache", agentID); + if (!m_NeedsListOfFriends.Remove(agentID)) return; - } - - // - // Send the friends online - // - List online = GetOnlineFriends(agentID); - if (online.Count > 0) - { - m_log.DebugFormat("[FRIENDS MODULE]: User {0} in region {1} has {2} friends online", client.AgentId, client.Scene.RegionInfo.RegionName, online.Count); - client.SendAgentOnline(online.ToArray()); - } - - // - // Send outstanding friendship offers - // - if (m_Friends.ContainsKey(agentID)) - { - List outstanding = new List(); + } - foreach (FriendInfo fi in m_Friends[agentID].Friends) - if (fi.TheirFlags == -1) - outstanding.Add(fi.Friend); + // Send the friends online + List online = GetOnlineFriends(agentID); + if (online.Count > 0) + { + m_log.DebugFormat("[FRIENDS MODULE]: User {0} in region {1} has {2} friends online", client.AgentId, client.Scene.RegionInfo.RegionName, online.Count); + client.SendAgentOnline(online.ToArray()); + } - GridInstantMessage im = new GridInstantMessage(client.Scene, UUID.Zero, "", agentID, (byte)InstantMessageDialog.FriendshipOffered, "Will you be my friend?", true, Vector3.Zero); - foreach (string fid in outstanding) - { - try - { - im.fromAgentID = new Guid(fid); - } - catch - { - continue; - } + // Send outstanding friendship offers + List outstanding = new List(); + FriendInfo[] friends = GetFriends(agentID); + foreach (FriendInfo fi in friends) + { + if (fi.TheirFlags == -1) + outstanding.Add(fi.Friend); + } - UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(client.Scene.RegionInfo.ScopeID, new UUID(im.fromAgentID)); - im.fromAgentName = account.FirstName + " " + account.LastName; + GridInstantMessage im = new GridInstantMessage(client.Scene, UUID.Zero, String.Empty, agentID, (byte)InstantMessageDialog.FriendshipOffered, + "Will you be my friend?", true, Vector3.Zero); - PresenceInfo presence = PresenceService.GetAgent(new UUID(im.fromAgentID)); - if (presence != null) - im.offline = 0; + foreach (string fid in outstanding) + { + UUID fromAgentID; + if (!UUID.TryParse(fid, out fromAgentID)) + continue; - im.imSessionID = im.fromAgentID; + UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(client.Scene.RegionInfo.ScopeID, fromAgentID); + PresenceInfo presence = PresenceService.GetAgent(fromAgentID); - // Finally - LocalFriendshipOffered(agentID, im); - } - } + im.fromAgentID = fromAgentID.Guid; + im.fromAgentName = account.FirstName + " " + account.LastName; + im.offline = (byte)((presence == null) ? 1 : 0); + im.imSessionID = im.fromAgentID; - lock (m_NeedsListOfFriends) - m_NeedsListOfFriends.Remove(agentID); + // Finally + LocalFriendshipOffered(agentID, im); } } @@ -369,44 +334,46 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends List friendList = new List(); List online = new List(); - foreach (FriendInfo fi in m_Friends[userID].Friends) + FriendInfo[] friends = GetFriends(userID); + foreach (FriendInfo fi in friends) { if (((fi.TheirFlags & 1) != 0) && (fi.TheirFlags != -1)) friendList.Add(fi.Friend); } - if (friendList.Count == 0) - // no friends whatsoever - return online; - - PresenceInfo[] presence = PresenceService.GetAgents(friendList.ToArray()); - - foreach (PresenceInfo pi in presence) - online.Add(new UUID(pi.UserID)); - //m_log.DebugFormat("[XXX] {0} friend online {1}", userID, pi.UserID); + if (friendList.Count > 0) + { + PresenceInfo[] presence = PresenceService.GetAgents(friendList.ToArray()); + foreach (PresenceInfo pi in presence) + { + UUID presenceID; + if (UUID.TryParse(pi.UserID, out presenceID)) + online.Add(presenceID); + } + } return online; } - // - // Find the client for a ID - // + /// + /// Find the client for a ID + /// public IClientAPI LocateClientObject(UUID agentID) { Scene scene = GetClientScene(agentID); - if (scene == null) - return null; - - ScenePresence presence = scene.GetScenePresence(agentID); - if (presence == null) - return null; + if (scene != null) + { + ScenePresence presence = scene.GetScenePresence(agentID); + if (presence != null) + return presence.ControllingClient; + } - return presence.ControllingClient; + return null; } - // - // Find the scene for an agent - // + /// + /// Find the scene for an agent + /// private Scene GetClientScene(UUID agentId) { lock (m_Scenes) @@ -414,13 +381,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends foreach (Scene scene in m_Scenes) { ScenePresence presence = scene.GetScenePresence(agentId); - if (presence != null) - { - if (!presence.IsChildAgent) - return scene; - } + if (presence != null && !presence.IsChildAgent) + return scene; } } + return null; } @@ -431,35 +396,33 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends /// private void StatusChange(UUID agentID, bool online) { - //m_log.DebugFormat("[FRIENDS]: StatusChange {0}", online); - if (m_Friends.ContainsKey(agentID)) + FriendInfo[] friends = GetFriends(agentID); + if (friends.Length > 0) { - //m_log.DebugFormat("[FRIENDS]: # of friends: {0}", m_Friends[agentID].Friends.Length); List friendList = new List(); - foreach (FriendInfo fi in m_Friends[agentID].Friends) + foreach (FriendInfo fi in friends) { if (((fi.MyFlags & 1) != 0) && (fi.TheirFlags != -1)) friendList.Add(fi); } - Util.FireAndForget(delegate - { - foreach (FriendInfo fi in friendList) + Util.FireAndForget( + delegate { - //m_log.DebugFormat("[FRIENDS]: Notifying {0}", fi.PrincipalID); - // Notify about this user status - StatusNotify(fi, agentID, online); + foreach (FriendInfo fi in friendList) + { + //m_log.DebugFormat("[FRIENDS]: Notifying {0}", fi.PrincipalID); + // Notify about this user status + StatusNotify(fi, agentID, online); + } } - }); + ); } - else - m_log.WarnFormat("[FRIENDS]: {0} not found in cache", agentID); } private void StatusNotify(FriendInfo friend, UUID userID, bool online) { - UUID friendID = UUID.Zero; - + UUID friendID; if (UUID.TryParse(friend.Friend, out friendID)) { // Try local @@ -476,12 +439,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends } } else + { m_log.WarnFormat("[FRIENDS]: Error parsing friend ID {0}", friend.Friend); + } } private void OnInstantMessage(IClientAPI client, GridInstantMessage im) { - if (im.dialog == (byte)OpenMetaverse.InstantMessageDialog.FriendshipOffered) + if ((InstantMessageDialog)im.dialog == InstantMessageDialog.FriendshipOffered) { // we got a friendship offer UUID principalID = new UUID(im.fromAgentID); @@ -527,9 +492,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends FriendsService.StoreFriend(agentID, friendID.ToString(), 1); FriendsService.StoreFriend(friendID, agentID.ToString(), 1); - // update the local cache - m_Friends[agentID].Friends = FriendsService.GetFriends(agentID); + // Update the local cache + UpdateFriendsCache(agentID); // // Notify the friend @@ -584,7 +549,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends FriendsService.Delete(exfriendID, agentID.ToString()); // Update local cache - m_Friends[agentID].Friends = FriendsService.GetFriends(agentID); + UpdateFriendsCache(agentID); client.SendTerminateFriend(exfriendID); @@ -606,16 +571,18 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends private void OnGrantUserRights(IClientAPI remoteClient, UUID requester, UUID target, int rights) { - if (!m_Friends.ContainsKey(remoteClient.AgentId)) + FriendInfo[] friends = GetFriends(remoteClient.AgentId); + if (friends.Length == 0) return; m_log.DebugFormat("[FRIENDS MODULE]: User {0} changing rights to {1} for friend {2}", requester, rights, target); // Let's find the friend in this user's friend list - UserFriendData fd = m_Friends[remoteClient.AgentId]; FriendInfo friend = null; - foreach (FriendInfo fi in fd.Friends) + foreach (FriendInfo fi in friends) + { if (fi.Friend == target.ToString()) friend = fi; + } if (friend != null) // Found it { @@ -672,8 +639,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends GridInstantMessage im = new GridInstantMessage(Scene, userID, userName, friendID, (byte)OpenMetaverse.InstantMessageDialog.FriendshipAccepted, userID.ToString(), false, Vector3.Zero); friendClient.SendInstantMessage(im); - // update the local cache - m_Friends[friendID].Friends = FriendsService.GetFriends(friendID); + + // Update the local cache + UpdateFriendsCache(friendID); + // we're done return true; } @@ -687,7 +656,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends if (friendClient != null) { // the prospective friend in this sim as root agent - GridInstantMessage im = new GridInstantMessage(Scene, userID, userName, friendID, (byte)OpenMetaverse.InstantMessageDialog.FriendshipDeclined, userID.ToString(), false, Vector3.Zero); friendClient.SendInstantMessage(im); @@ -706,7 +674,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends // the friend in this sim as root agent friendClient.SendTerminateFriend(exfriendID); // update local cache - m_Friends[exfriendID].Friends = FriendsService.GetFriends(exfriendID); + UpdateFriendsCache(exfriendID); // we're done return true; } @@ -735,11 +703,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends } - // update local cache - //m_Friends[friendID].Friends = m_FriendsService.GetFriends(friendID); - foreach (FriendInfo finfo in m_Friends[friendID].Friends) - if (finfo.Friend == userID.ToString()) - finfo.TheirFlags = rights; + // Update local cache + lock (m_Friends) + { + FriendInfo[] friends = GetFriends(friendID); + foreach (FriendInfo finfo in friends) + { + if (finfo.Friend == userID.ToString()) + finfo.TheirFlags = rights; + } + } return true; } @@ -765,7 +738,30 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends return false; } + #endregion + private FriendInfo[] GetFriends(UUID agentID) + { + UserFriendData friendsData; + + lock (m_Friends) + { + if (m_Friends.TryGetValue(agentID, out friendsData)) + return friendsData.Friends; + } + + return EMPTY_FRIENDS; + } + + private void UpdateFriendsCache(UUID agentID) + { + lock (m_Friends) + { + UserFriendData friendsData; + if (m_Friends.TryGetValue(agentID, out friendsData)) + friendsData.Friends = FriendsService.GetFriends(agentID); + } + } } } -- cgit v1.1 From dd277a0d02f1aa79f4fcb5d108cbc696e90500c2 Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Fri, 10 Sep 2010 12:04:12 -0700 Subject: First pass at cleaning up thread safety in EntityManager and SceneGraph --- OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | 2 +- .../CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs | 2 +- OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs | 3 ++- OpenSim/Region/CoreModules/World/Serialiser/SerialiseObjects.cs | 2 +- OpenSim/Region/CoreModules/World/Serialiser/SerialiserModule.cs | 4 ++-- OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs | 2 +- 6 files changed, 8 insertions(+), 7 deletions(-) (limited to 'OpenSim/Region/CoreModules') diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index dd7d831..7270304 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -436,7 +436,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments // We can NOT use the dictionries here, as we are looking // for an entity by the fromAssetID, which is NOT the prim UUID - List detachEntities = m_scene.GetEntities(); + EntityBase[] detachEntities = m_scene.GetEntities(); SceneObjectGroup group; foreach (EntityBase entity in detachEntities) diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs index b25636f..283b33b 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs @@ -102,7 +102,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver { Dictionary assetUuids = new Dictionary(); - List entities = m_scene.GetEntities(); + EntityBase[] entities = m_scene.GetEntities(); List sceneObjects = new List(); /* diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index da7a284..ea71fd9 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs @@ -794,7 +794,8 @@ namespace OpenSim.Region.CoreModules.World.Land public void EventManagerOnParcelPrimCountUpdate() { ResetAllLandPrimCounts(); - foreach (EntityBase obj in m_scene.Entities) + EntityBase[] entities = m_scene.Entities.GetEntities(); + foreach (EntityBase obj in entities) { if (obj != null) { diff --git a/OpenSim/Region/CoreModules/World/Serialiser/SerialiseObjects.cs b/OpenSim/Region/CoreModules/World/Serialiser/SerialiseObjects.cs index bef7fe4..5067ebd 100644 --- a/OpenSim/Region/CoreModules/World/Serialiser/SerialiseObjects.cs +++ b/OpenSim/Region/CoreModules/World/Serialiser/SerialiseObjects.cs @@ -80,7 +80,7 @@ namespace OpenSim.Region.CoreModules.World.Serialiser { string xmlstream = ""; - List EntityList = scene.GetEntities(); + EntityBase[] EntityList = scene.GetEntities(); List EntityXml = new List(); foreach (EntityBase ent in EntityList) diff --git a/OpenSim/Region/CoreModules/World/Serialiser/SerialiserModule.cs b/OpenSim/Region/CoreModules/World/Serialiser/SerialiserModule.cs index 58e4261..98fe493 100644 --- a/OpenSim/Region/CoreModules/World/Serialiser/SerialiserModule.cs +++ b/OpenSim/Region/CoreModules/World/Serialiser/SerialiserModule.cs @@ -165,12 +165,12 @@ namespace OpenSim.Region.CoreModules.World.Serialiser return SceneXmlLoader.SaveGroupToXml2(grp); } - public void SavePrimListToXml2(List entityList, string fileName) + public void SavePrimListToXml2(EntityBase[] entityList, string fileName) { SceneXmlLoader.SavePrimListToXml2(entityList, fileName); } - public void SavePrimListToXml2(List entityList, TextWriter stream, Vector3 min, Vector3 max) + public void SavePrimListToXml2(EntityBase[] entityList, TextWriter stream, Vector3 min, Vector3 max) { SceneXmlLoader.SavePrimListToXml2(entityList, stream, min, max); } diff --git a/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs index 57eff8a..1d9c2bd 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs @@ -212,7 +212,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap double[,] hm = whichScene.Heightmap.GetDoubles(); tc = Environment.TickCount; m_log.Info("[MAPTILE]: Generating Maptile Step 2: Object Volume Profile"); - List objs = whichScene.GetEntities(); + EntityBase[] objs = whichScene.GetEntities(); Dictionary z_sort = new Dictionary(); //SortedList z_sort = new SortedList(); List z_sortheights = new List(); -- cgit v1.1 From f1f0bc23f4501ba99035283d3407ddad2b21b785 Mon Sep 17 00:00:00 2001 From: Jeff Ames Date: Sun, 12 Sep 2010 13:43:49 -0400 Subject: Formatting cleanup. --- .../Avatar/Attachments/AttachmentsModule.cs | 24 ++--- .../CoreModules/Avatar/Combat/CombatModule.cs | 4 +- .../Region/CoreModules/Avatar/Gods/GodsModule.cs | 6 +- .../Avatar/InstantMessage/MessageTransferModule.cs | 2 +- .../Archiver/InventoryArchiveReadRequest.cs | 18 ++-- .../Archiver/InventoryArchiveWriteRequest.cs | 10 +- .../Archiver/InventoryArchiverException.cs | 2 +- .../Inventory/Archiver/InventoryArchiverModule.cs | 28 ++--- .../Archiver/Tests/InventoryArchiverTests.cs | 54 +++++----- .../Framework/EventQueue/EventQueueGetModule.cs | 4 +- .../Framework/EventQueue/EventQueueHelper.cs | 18 ++-- .../InventoryAccess/InventoryAccessModule.cs | 2 +- .../Statistics/Logging/BinaryLoggingModule.cs | 12 +-- .../Inventory/InventoryCache.cs | 2 +- .../Inventory/LocalInventoryServiceConnector.cs | 2 +- .../Inventory/RemoteXInventoryServiceConnector.cs | 2 +- .../CoreModules/World/Archiver/ArchiveHelpers.cs | 8 +- .../CoreModules/World/Land/LandManagementModule.cs | 115 ++++++++++----------- .../Region/CoreModules/World/Land/LandObject.cs | 14 +-- .../CoreModules/World/Media/Moap/MoapModule.cs | 98 +++++++++--------- .../World/Objects/BuySell/BuySellModule.cs | 14 +-- .../World/Permissions/PermissionsModule.cs | 22 ++-- .../CoreModules/World/Terrain/TerrainModule.cs | 2 +- .../Region/CoreModules/World/Wind/WindModule.cs | 2 +- .../CoreModules/World/WorldMap/MapImageModule.cs | 2 +- .../CoreModules/World/WorldMap/WorldMapModule.cs | 2 +- 26 files changed, 232 insertions(+), 237 deletions(-) (limited to 'OpenSim/Region/CoreModules') diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 7270304..5604f49 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -48,8 +48,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments protected Scene m_scene = null; - public string Name { get { return "Attachments Module"; } } - public Type ReplaceableInterface { get { return null; } } + public string Name { get { return "Attachments Module"; } } + public Type ReplaceableInterface { get { return null; } } public void Initialise(IConfigSource source) {} @@ -80,7 +80,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments client.OnRezMultipleAttachmentsFromInv += RezMultipleAttachmentsFromInventory; client.OnObjectAttach += AttachObject; client.OnObjectDetach += DetachObject; - client.OnDetachAttachmentIntoInv += ShowDetachInUserInventory; + client.OnDetachAttachmentIntoInv += ShowDetachInUserInventory; } public void UnsubscribeFromClientEvents(IClientAPI client) @@ -89,7 +89,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments client.OnRezMultipleAttachmentsFromInv -= RezMultipleAttachmentsFromInventory; client.OnObjectAttach -= AttachObject; client.OnObjectDetach -= DetachObject; - client.OnDetachAttachmentIntoInv -= ShowDetachInUserInventory; + client.OnDetachAttachmentIntoInv -= ShowDetachInUserInventory; } /// @@ -173,12 +173,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments UUID itemID = UUID.Zero; if (sp != null) { - foreach(SceneObjectGroup grp in sp.GetAttachments(AttachmentPt)) + foreach (SceneObjectGroup grp in sp.GetAttachments(AttachmentPt)) { itemID = grp.GetFromItemID(); if (itemID != UUID.Zero) DetachSingleAttachmentToInv(itemID, remoteClient); - } + } } if (group.GetFromItemID() == UUID.Zero) @@ -225,7 +225,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments public UUID RezSingleAttachmentFromInventory( IClientAPI remoteClient, UUID itemID, uint AttachmentPt, bool updateInventoryStatus) - { + { SceneObjectGroup att = RezSingleAttachmentFromInventoryInternal(remoteClient, itemID, AttachmentPt); if (updateInventoryStatus) @@ -241,8 +241,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments if (null == att) return UUID.Zero; else - return att.UUID; - } + return att.UUID; + } protected SceneObjectGroup RezSingleAttachmentFromInventoryInternal( IClientAPI remoteClient, UUID itemID, uint AttachmentPt) @@ -298,7 +298,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments } return null; - } + } public UUID SetAttachmentInventoryStatus( SceneObjectGroup att, IClientAPI remoteClient, UUID itemID, uint AttachmentPt) @@ -473,7 +473,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments sog.RootPart.IsAttachment = false; sog.AbsolutePosition = sog.RootPart.AttachedPos; UpdateKnownItem(client, sog, sog.GetFromItemID(), sog.OwnerID); - sog.SetAttachmentPoint(attachmentPoint); + sog.SetAttachmentPoint(attachmentPoint); } /// @@ -600,7 +600,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments // In case it is later dropped again, don't let // it get cleaned up so.RootPart.RemFlag(PrimFlags.TemporaryOnRez); - so.HasGroupChanged = false; + so.HasGroupChanged = false; } } } diff --git a/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs b/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs index 032e55a..25322a1 100644 --- a/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs @@ -132,7 +132,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Combat.CombatModule try { deadAvatar.ControllingClient.SendAgentAlertMessage(deadAvatarMessage, true); - if(killingAvatar != null) + if (killingAvatar != null) killingAvatar.ControllingClient.SendAlertMessage("You fragged " + deadAvatar.Firstname + " " + deadAvatar.Lastname); } catch (InvalidOperationException) @@ -143,7 +143,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Combat.CombatModule } private void AvatarEnteringParcel(ScenePresence avatar, int localLandID, UUID regionID) - { + { try { ILandObject obj = avatar.Scene.LandChannel.GetLandObject(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y); diff --git a/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs b/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs index 4b30b0d..5ec64d5 100644 --- a/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs @@ -58,13 +58,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods public void SubscribeToClientEvents(IClientAPI client) { client.OnGodKickUser += KickUser; - client.OnRequestGodlikePowers += RequestGodlikePowers; - } + client.OnRequestGodlikePowers += RequestGodlikePowers; + } public void UnsubscribeFromClientEvents(IClientAPI client) { client.OnGodKickUser -= KickUser; - client.OnRequestGodlikePowers -= RequestGodlikePowers; + client.OnRequestGodlikePowers -= RequestGodlikePowers; } public void RequestGodlikePowers( diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs index 13bae2e..43bbf0d 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs @@ -137,7 +137,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage { if (scene.Entities.ContainsKey(toAgentID) && scene.Entities[toAgentID] is ScenePresence) - { + { // m_log.DebugFormat( // "[INSTANT MESSAGE]: Looking for root agent {0} in {1}", // toAgentID.ToString(), scene.RegionInfo.RegionName); diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs index 52342ec..c1df827 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs @@ -179,14 +179,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver m_log.DebugFormat( "[INVENTORY ARCHIVER]: Successfully loaded {0} assets with {1} failures", successfulAssetRestores, failedAssetRestores); - m_log.InfoFormat("[INVENTORY ARCHIVER]: Successfully loaded {0} items", successfulItemRestores); + m_log.InfoFormat("[INVENTORY ARCHIVER]: Successfully loaded {0} items", successfulItemRestores); return loadedNodes; } finally { m_loadStream.Close(); - } + } } public void Close() @@ -201,7 +201,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver /// The item archive path to replicate /// The root folder for the inventory load /// - /// The folders that we have resolved so far for a given archive path. + /// The folders that we have resolved so far for a given archive path. /// This method will add more folders if necessary /// /// @@ -246,17 +246,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver /// The root folder for the inventory load /// /// - /// The folders that we have resolved so far for a given archive path. + /// The folders that we have resolved so far for a given archive path. /// /// /// The folder in the user's inventory that matches best the archive path given. If no such folder was found /// then the passed in root destination folder is returned. - /// + /// protected InventoryFolderBase ResolveDestinationFolder( - InventoryFolderBase rootDestFolder, - ref string archivePath, + InventoryFolderBase rootDestFolder, + ref string archivePath, Dictionary resolvedFolders) - { + { // string originalArchivePath = archivePath; while (archivePath.Length > 0) @@ -370,7 +370,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver if (0 == i) loadedNodes.Add(destFolder); - } + } } /// diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs index 9908018..bae5a7a 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs @@ -119,7 +119,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver protected void ReceivedAllAssets(ICollection assetsFoundUuids, ICollection assetsNotFoundUuids) { Exception reportedException = null; - bool succeeded = true; + bool succeeded = true; try { @@ -136,7 +136,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver finally { m_saveStream.Close(); - } + } m_module.TriggerInventoryArchiveSaved( m_id, succeeded, m_userInfo, m_invPath, m_saveStream, reportedException); @@ -270,7 +270,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver { // We couldn't find the path indicated string errorMessage = string.Format("Aborted save. Could not find inventory path {0}", m_invPath); - Exception e = new InventoryArchiverException(errorMessage); + Exception e = new InventoryArchiverException(errorMessage); m_module.TriggerInventoryArchiveSaved(m_id, false, m_userInfo, m_invPath, m_saveStream, e); throw e; } @@ -283,7 +283,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver "[INVENTORY ARCHIVER]: Found folder {0} {1} at {2}", inventoryFolder.Name, inventoryFolder.ID, - m_invPath == String.Empty ? InventoryFolderImpl.PATH_DELIMITER : m_invPath ); + m_invPath == String.Empty ? InventoryFolderImpl.PATH_DELIMITER : m_invPath); //recurse through all dirs getting dirs and files SaveInvFolder(inventoryFolder, ArchiveConstants.INVENTORY_PATH, !saveFolderContentsOnly); @@ -301,7 +301,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver //SaveUsers(); new AssetsRequest( - new AssetsArchiver(m_archiveWriter), m_assetUuids, m_scene.AssetService, ReceivedAllAssets).Execute(); + new AssetsArchiver(m_archiveWriter), m_assetUuids, m_scene.AssetService, ReceivedAllAssets).Execute(); } catch (Exception) { diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverException.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverException.cs index e07e2ca..5fd1a7e 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverException.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverException.cs @@ -33,7 +33,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver /// Signals an inventory archiving problem /// public class InventoryArchiverException : Exception - { + { public InventoryArchiverException(string message) : base(message) {} public InventoryArchiverException(string message, Exception e) : base(message, e) {} } diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs index f03f2a1..2eaca49 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs @@ -91,12 +91,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver scene.AddCommand( this, "load iar", - "load iar []", + "load iar []", //"load iar [--merge] []", "Load user inventory archive (IAR).", //"--merge is an option which merges the loaded IAR with existing inventory folders where possible, rather than always creating new ones" //+ " is user's first name." + Environment.NewLine - " is user's first name." + Environment.NewLine + " is user's first name." + Environment.NewLine + " is user's last name." + Environment.NewLine + " is the path inside the user's inventory where the IAR should be loaded." + Environment.NewLine + " is the user's password." + Environment.NewLine @@ -241,7 +241,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver if (CheckPresence(userInfo.PrincipalID)) { InventoryArchiveReadRequest request; - bool merge = (options.ContainsKey("merge") ? (bool)options["merge"] : false); + bool merge = (options.ContainsKey("merge") ? (bool)options["merge"] : false); try { @@ -286,10 +286,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver if (CheckPresence(userInfo.PrincipalID)) { InventoryArchiveReadRequest request; - bool merge = (options.ContainsKey("merge") ? (bool)options["merge"] : false); + bool merge = (options.ContainsKey("merge") ? (bool)options["merge"] : false); try - { + { request = new InventoryArchiveReadRequest(m_aScene, userInfo, invPath, loadPath, merge); } catch (EntryPointNotFoundException e) @@ -325,20 +325,20 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver protected void HandleLoadInvConsoleCommand(string module, string[] cmdparams) { try - { - m_log.Info("[INVENTORY ARCHIVER]: PLEASE NOTE THAT THIS FACILITY IS EXPERIMENTAL. BUG REPORTS WELCOME."); - - Dictionary options = new Dictionary(); + { + m_log.Info("[INVENTORY ARCHIVER]: PLEASE NOTE THAT THIS FACILITY IS EXPERIMENTAL. BUG REPORTS WELCOME."); + + Dictionary options = new Dictionary(); OptionSet optionSet = new OptionSet().Add("m|merge", delegate (string v) { options["merge"] = v != null; }); List mainParams = optionSet.Parse(cmdparams); - + if (mainParams.Count < 6) { m_log.Error( "[INVENTORY ARCHIVER]: usage is load iar [--merge] []"); return; - } + } string firstName = mainParams[2]; string lastName = mainParams[3]; @@ -353,7 +353,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver if (DearchiveInventory(firstName, lastName, invPath, pass, loadPath, options)) m_log.InfoFormat( "[INVENTORY ARCHIVER]: Loaded archive {0} for {1} {2}", - loadPath, firstName, lastName); + loadPath, firstName, lastName); } catch (InventoryArchiverException e) { @@ -390,7 +390,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver "[INVENTORY ARCHIVER]: Saving archive {0} using inventory path {1} for {2} {3}", savePath, invPath, firstName, lastName); - ArchiveInventory(id, firstName, lastName, invPath, pass, savePath, new Dictionary()); + ArchiveInventory(id, firstName, lastName, invPath, pass, savePath, new Dictionary()); } catch (InventoryArchiverException e) { @@ -398,7 +398,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver } lock (m_pendingConsoleSaves) - m_pendingConsoleSaves.Add(id); + m_pendingConsoleSaves.Add(id); } private void SaveInvConsoleCommandCompleted( diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs index d66a1d0..938886b2 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs @@ -58,18 +58,18 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests /// /// Stream of data representing a common IAR that can be reused in load tests. /// - protected MemoryStream m_iarStream; + protected MemoryStream m_iarStream; protected UserAccount m_ua1 = new UserAccount { PrincipalID = UUID.Parse("00000000-0000-0000-0000-000000000555"), FirstName = "Mr", - LastName = "Tiddles" }; + LastName = "Tiddles" }; protected UserAccount m_ua2 = new UserAccount { PrincipalID = UUID.Parse("00000000-0000-0000-0000-000000000666"), FirstName = "Lord", - LastName = "Lucan" }; + LastName = "Lucan" }; string m_item1Name = "b.lsl"; private void SaveCompleted( @@ -86,7 +86,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests } protected void ConstructDefaultIarForTestLoad() - { + { string archiveItemName = InventoryArchiveWriteRequest.CreateArchiveItemName(m_item1Name, UUID.Random()); MemoryStream archiveWriteStream = new MemoryStream(); @@ -104,7 +104,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests string item1FileName = string.Format("{0}{1}", ArchiveConstants.INVENTORY_PATH, archiveItemName); tar.WriteFile(item1FileName, UserInventoryItemSerializer.Serialize(item1)); - tar.Close(); + tar.Close(); m_iarStream = new MemoryStream(archiveWriteStream.ToArray()); } @@ -341,7 +341,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests // Assert.That(gotObject2File, Is.True, "No object2 file in archive"); // TODO: Test presence of more files and contents of files. - } + } /// /// Test that things work when the load path specified starts with a slash @@ -349,22 +349,22 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests [Test] public void TestLoadIarPathStartsWithSlash() { - TestHelper.InMethod(); + TestHelper.InMethod(); // log4net.Config.XmlConfigurator.Configure(); SerialiserModule serialiserModule = new SerialiserModule(); - InventoryArchiverModule archiverModule = new InventoryArchiverModule(true); - Scene scene = SceneSetupHelpers.SetupScene("inventory"); + InventoryArchiverModule archiverModule = new InventoryArchiverModule(true); + Scene scene = SceneSetupHelpers.SetupScene("inventory"); SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule); - UserProfileTestUtils.CreateUserWithInventory(scene, m_ua1, "password"); + UserProfileTestUtils.CreateUserWithInventory(scene, m_ua1, "password"); archiverModule.DearchiveInventory(m_ua1.FirstName, m_ua1.LastName, "/Objects", "password", m_iarStream); InventoryItemBase foundItem1 = InventoryArchiveUtils.FindItemByPath( scene.InventoryService, m_ua1.PrincipalID, "/Objects/" + m_item1Name); - Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1 in TestLoadIarFolderStartsWithSlash()"); + Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1 in TestLoadIarFolderStartsWithSlash()"); } /// @@ -376,7 +376,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests [Test] public void TestLoadIarV0_1ExistingUsers() { - TestHelper.InMethod(); + TestHelper.InMethod(); //log4net.Config.XmlConfigurator.Configure(); SerialiserModule serialiserModule = new SerialiserModule(); @@ -386,9 +386,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests Scene scene = SceneSetupHelpers.SetupScene("inventory"); SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule); - - UserProfileTestUtils.CreateUserWithInventory(scene, m_ua1, "meowfood"); - UserProfileTestUtils.CreateUserWithInventory(scene, m_ua2, "hampshire"); + + UserProfileTestUtils.CreateUserWithInventory(scene, m_ua1, "meowfood"); + UserProfileTestUtils.CreateUserWithInventory(scene, m_ua2, "hampshire"); archiverModule.DearchiveInventory(m_ua1.FirstName, m_ua1.LastName, "/", "meowfood", m_iarStream); @@ -450,7 +450,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests string userFirstName = "Jock"; string userLastName = "Stirrup"; UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000020"); - UserProfileTestUtils.CreateUserWithInventory(scene, userFirstName, userLastName, userId, "meowfood"); + UserProfileTestUtils.CreateUserWithInventory(scene, userFirstName, userLastName, userId, "meowfood"); // Create asset SceneObjectGroup object1; @@ -524,7 +524,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests [Test] public void TestLoadIarV0_1AbsentUsers() { - TestHelper.InMethod(); + TestHelper.InMethod(); //log4net.Config.XmlConfigurator.Configure(); string userFirstName = "Charlie"; @@ -562,7 +562,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests Scene scene = SceneSetupHelpers.SetupScene("inventory"); SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule); - UserProfileTestUtils.CreateUserWithInventory(scene, userFirstName, userLastName, userUuid, "meowfood"); + UserProfileTestUtils.CreateUserWithInventory(scene, userFirstName, userLastName, userUuid, "meowfood"); archiverModule.DearchiveInventory(userFirstName, userLastName, "/", "meowfood", archiveReadStream); @@ -680,8 +680,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests string folder2aArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2aName, UUID.Random()); string folder2bArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2bName, UUID.Random()); - string iarPath1 = string.Join("", new string[] { folder1ArchiveName, folder2aArchiveName }); - string iarPath2 = string.Join("", new string[] { folder1ArchiveName, folder2bArchiveName }); + string iarPath1 = string.Join("", new string[] { folder1ArchiveName, folder2aArchiveName }); + string iarPath2 = string.Join("", new string[] { folder1ArchiveName, folder2bArchiveName }); { // Test replication of path1 @@ -694,7 +694,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, ua1.PrincipalID, folder1Name); Assert.That(folder1Candidates.Count, Is.EqualTo(1)); - InventoryFolderBase folder1 = folder1Candidates[0]; + InventoryFolderBase folder1 = folder1Candidates[0]; List folder2aCandidates = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1, folder2aName); Assert.That(folder2aCandidates.Count, Is.EqualTo(1)); @@ -715,11 +715,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests List folder2aCandidates = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1, folder2aName); - Assert.That(folder2aCandidates.Count, Is.EqualTo(1)); + Assert.That(folder2aCandidates.Count, Is.EqualTo(1)); List folder2bCandidates = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1, folder2bName); - Assert.That(folder2bCandidates.Count, Is.EqualTo(1)); + Assert.That(folder2bCandidates.Count, Is.EqualTo(1)); } } @@ -741,7 +741,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests InventoryFolderBase folder1 = UserInventoryTestUtils.CreateInventoryFolder( - scene.InventoryService, ua1.PrincipalID, folder1ExistingName); + scene.InventoryService, ua1.PrincipalID, folder1ExistingName); string folder1ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder1ExistingName, UUID.Random()); string folder2ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2Name, UUID.Random()); @@ -772,7 +772,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests List folder2PostCandidates = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1Post, "b"); Assert.That(folder2PostCandidates.Count, Is.EqualTo(1)); - } + } /// /// Test replication of a partly existing archive path to the user's inventory. This should create @@ -792,7 +792,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests InventoryFolderBase folder1 = UserInventoryTestUtils.CreateInventoryFolder( - scene.InventoryService, ua1.PrincipalID, folder1ExistingName); + scene.InventoryService, ua1.PrincipalID, folder1ExistingName); string folder1ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder1ExistingName, UUID.Random()); string folder2ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2Name, UUID.Random()); @@ -812,6 +812,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests List folder2PostCandidates = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1PostCandidates[0], "b"); Assert.That(folder2PostCandidates.Count, Is.EqualTo(1)); - } + } } } \ No newline at end of file diff --git a/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueGetModule.cs b/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueGetModule.cs index 35b70de..05fe3ee 100644 --- a/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueGetModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueGetModule.cs @@ -138,7 +138,7 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue { if (!queues.ContainsKey(agentId)) { - /* + /* m_log.DebugFormat( "[EVENTQUEUE]: Adding new queue for agent {0} in region {1}", agentId, m_scene.RegionInfo.RegionName); @@ -701,7 +701,7 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue public void ParcelProperties(ParcelPropertiesMessage parcelPropertiesMessage, UUID avatarID) { - OSD item = EventQueueHelper.ParcelProperties(parcelPropertiesMessage); + OSD item = EventQueueHelper.ParcelProperties(parcelPropertiesMessage); Enqueue(item, avatarID); } diff --git a/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueHelper.cs b/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueHelper.cs index b62df18..0d7d16a 100644 --- a/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueHelper.cs +++ b/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueHelper.cs @@ -55,7 +55,7 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue } // private static byte[] uintToByteArray(uint uIntValue) -// { +// { // byte[] result = new byte[4]; // Utils.UIntToBytesBig(uIntValue, result, 0); // return result; @@ -386,14 +386,14 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue return placesReply; } - public static OSD ParcelProperties(ParcelPropertiesMessage parcelPropertiesMessage) - { - OSDMap message = new OSDMap(); - message.Add("message", OSD.FromString("ParcelProperties")); - OSD message_body = parcelPropertiesMessage.Serialize(); - message.Add("body", message_body); - return message; - } + public static OSD ParcelProperties(ParcelPropertiesMessage parcelPropertiesMessage) + { + OSDMap message = new OSDMap(); + message.Add("message", OSD.FromString("ParcelProperties")); + OSD message_body = parcelPropertiesMessage.Serialize(); + message.Add("body", message_body); + return message; + } } } diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index d87f7f1..4c4eeff 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs @@ -594,7 +594,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess rootPart.Name = item.Name; rootPart.Description = item.Description; - List partList = null; + List partList = null; lock (group.Children) partList = new List(group.Children.Values); diff --git a/OpenSim/Region/CoreModules/Framework/Statistics/Logging/BinaryLoggingModule.cs b/OpenSim/Region/CoreModules/Framework/Statistics/Logging/BinaryLoggingModule.cs index b75a700..a75ff62 100644 --- a/OpenSim/Region/CoreModules/Framework/Statistics/Logging/BinaryLoggingModule.cs +++ b/OpenSim/Region/CoreModules/Framework/Statistics/Logging/BinaryLoggingModule.cs @@ -49,8 +49,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments protected bool m_collectStats; protected Scene m_scene = null; - public string Name { get { return "Binary Statistics Logging Module"; } } - public Type ReplaceableInterface { get { return null; } } + public string Name { get { return "Binary Statistics Logging Module"; } } + public Type ReplaceableInterface { get { return null; } } public void Initialise(IConfigSource source) { @@ -79,7 +79,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments catch { // if it doesn't work, we don't collect anything - } + } } public void AddRegion(Scene scene) @@ -94,12 +94,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments public void RegionLoaded(Scene scene) { if (m_collectStats) - m_scene.StatsReporter.OnSendStatsResult += LogSimStats; + m_scene.StatsReporter.OnSendStatsResult += LogSimStats; } public void Close() { - } + } public class StatLogger { @@ -164,6 +164,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments } } return; - } + } } } diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs index 4e2f602..2322d7c 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs @@ -185,7 +185,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory return folders[type]; } - m_log.WarnFormat("[INVENTORY CACHE]: Could not find folder for system type {0} for {1}", type, userID); + m_log.WarnFormat("[INVENTORY CACHE]: Could not find folder for system type {0} for {1}", type, userID); return null; } diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs index cbd9e05..ab6be50 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs @@ -220,7 +220,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory { // m_log.DebugFormat( // "[LOCAL INVENTORY SERVICES CONNECTOR]: Adding inventory item {0} to user {1} folder {2}", -// item.Name, item.Owner, item.Folder); +// item.Name, item.Owner, item.Folder); return m_InventoryService.AddItem(item); } diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs index 4ab6947..34205e3 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs @@ -227,7 +227,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory public bool AddItem(InventoryItemBase item) { if (item == null) - return false; + return false; return m_RemoteConnector.AddItem(item); } diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveHelpers.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveHelpers.cs index ddc3dd7..c72acc3 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveHelpers.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveHelpers.cs @@ -33,7 +33,7 @@ using OpenSim.Framework.Serialization; using OpenSim.Region.Framework.Scenes; namespace OpenSim.Region.CoreModules.World.Archiver -{ +{ /// /// Helper methods for archive manipulation /// @@ -50,7 +50,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver public static string CreateObjectFilename(SceneObjectGroup sog) { return ArchiveConstants.CreateOarObjectFilename(sog.Name, sog.UUID, sog.AbsolutePosition); - } + } /// /// Create the path used to store an object in an OpenSim Archive. @@ -62,7 +62,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver public static string CreateObjectPath(SceneObjectGroup sog) { return ArchiveConstants.CreateOarObjectPath(sog.Name, sog.UUID, sog.AbsolutePosition); - } + } /// /// Resolve path to a working FileStream @@ -123,6 +123,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver // return new BufferedStream(file, (int) response.ContentLength); return new BufferedStream(file, 1000000); - } + } } } \ No newline at end of file diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index ea71fd9..634685a 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs @@ -72,12 +72,12 @@ namespace OpenSim.Region.CoreModules.World.Land #pragma warning restore 0429 /// - /// Local land ids at specified region co-ordinates (region size / 4) + /// Local land ids at specified region co-ordinates (region size / 4) /// private readonly int[,] m_landIDList = new int[landArrayMax, landArrayMax]; /// - /// Land objects keyed by local id + /// Land objects keyed by local id /// private readonly Dictionary m_landList = new Dictionary(); @@ -92,8 +92,8 @@ namespace OpenSim.Region.CoreModules.World.Land #region INonSharedRegionModule Members - public Type ReplaceableInterface - { + public Type ReplaceableInterface + { get { return null; } } @@ -192,7 +192,7 @@ namespace OpenSim.Region.CoreModules.World.Land Debug.WriteLine(string.Format("Stopping force position because {0} is close enough to position {1}", forcedPosition.Value, clientAvatar.AbsolutePosition)); forcedPosition = null; } - //if we are far away, teleport + //if we are far away, teleport else if (Vector3.Distance(clientAvatar.AbsolutePosition, forcedPosition.Value) > 3) { Debug.WriteLine(string.Format("Teleporting out because {0} is too far from avatar position {1}", forcedPosition.Value, clientAvatar.AbsolutePosition)); @@ -321,8 +321,6 @@ namespace OpenSim.Region.CoreModules.World.Land } } - - private void ForceAvatarToPosition(ScenePresence avatar, Vector3? position) { if (m_scene.Permissions.IsGod(avatar.UUID)) return; @@ -336,7 +334,6 @@ namespace OpenSim.Region.CoreModules.World.Land { avatar.ControllingClient.SendAlertMessage( "You are not allowed on this parcel because the land owner has restricted access."); - } public void EventManagerOnAvatarEnteringNewParcel(ScenePresence avatar, int localLandID, UUID regionID) @@ -448,7 +445,7 @@ namespace OpenSim.Region.CoreModules.World.Land if (clientAvatar.AbsolutePosition.Z < LandChannel.BAN_LINE_SAFETY_HIEGHT && clientAvatar.sentMessageAboutRestrictedParcelFlyingDown) { - EventManagerOnAvatarEnteringNewParcel(clientAvatar, parcel.LandData.LocalID, + EventManagerOnAvatarEnteringNewParcel(clientAvatar, parcel.LandData.LocalID, m_scene.RegionInfo.RegionID); //They are going under the safety line! if (!parcel.IsBannedFromLand(clientAvatar.UUID)) @@ -652,7 +649,7 @@ namespace OpenSim.Region.CoreModules.World.Land if (x_float > Constants.RegionSize || x_float <= 0 || y_float > Constants.RegionSize || y_float <= 0) return null; - + try { x = Convert.ToInt32(Math.Floor(Convert.ToDouble(x_float) / 4.0)); @@ -667,7 +664,7 @@ namespace OpenSim.Region.CoreModules.World.Land { return null; } - + lock (m_landList) { // Corner case. If an autoreturn happens during sim startup @@ -687,7 +684,7 @@ namespace OpenSim.Region.CoreModules.World.Land // they happen every time at border crossings throw new Exception("Error: Parcel not found at point " + x + ", " + y); } - + lock (m_landIDList) { try @@ -741,7 +738,6 @@ namespace OpenSim.Region.CoreModules.World.Land public void EventManagerOnObjectBeingRemovedFromScene(SceneObjectGroup obj) { - lock (m_landList) { foreach (LandObject p in m_landList.Values) @@ -936,7 +932,7 @@ namespace OpenSim.Region.CoreModules.World.Land return; } } - + lock (m_landList) { foreach (ILandObject slaveLandObject in selectedLandObjects) @@ -1078,7 +1074,6 @@ namespace OpenSim.Region.CoreModules.World.Land temp.Add(currentParcel); } } - } } @@ -1121,7 +1116,7 @@ namespace OpenSim.Region.CoreModules.World.Land join(west, south, east, north, remote_client.AgentId); } - public void ClientOnParcelSelectObjects(int local_id, int request_type, + public void ClientOnParcelSelectObjects(int local_id, int request_type, List returnIDs, IClientAPI remote_client) { m_landList[local_id].SendForceObjectSelect(local_id, request_type, returnIDs, remote_client); @@ -1358,31 +1353,31 @@ namespace OpenSim.Region.CoreModules.World.Land { return RemoteParcelRequest(request, path, param, agentID, caps); })); - UUID parcelCapID = UUID.Random(); - caps.RegisterHandler("ParcelPropertiesUpdate", - new RestStreamHandler("POST", "/CAPS/" + parcelCapID, - delegate(string request, string path, string param, - OSHttpRequest httpRequest, OSHttpResponse httpResponse) - { - return ProcessPropertiesUpdate(request, path, param, agentID, caps); - })); - } - private string ProcessPropertiesUpdate(string request, string path, string param, UUID agentID, Caps caps) - { - IClientAPI client; - if ( ! m_scene.TryGetClient(agentID, out client) ) { - m_log.WarnFormat("[LAND] unable to retrieve IClientAPI for {0}", agentID.ToString() ); - return LLSDHelpers.SerialiseLLSDReply(new LLSDEmpty()); - } - - ParcelPropertiesUpdateMessage properties = new ParcelPropertiesUpdateMessage(); - OpenMetaverse.StructuredData.OSDMap args = (OpenMetaverse.StructuredData.OSDMap) OSDParser.DeserializeLLSDXml(request); - - properties.Deserialize(args); - - LandUpdateArgs land_update = new LandUpdateArgs(); - int parcelID = properties.LocalID; - land_update.AuthBuyerID = properties.AuthBuyerID; + UUID parcelCapID = UUID.Random(); + caps.RegisterHandler("ParcelPropertiesUpdate", + new RestStreamHandler("POST", "/CAPS/" + parcelCapID, + delegate(string request, string path, string param, + OSHttpRequest httpRequest, OSHttpResponse httpResponse) + { + return ProcessPropertiesUpdate(request, path, param, agentID, caps); + })); + } + private string ProcessPropertiesUpdate(string request, string path, string param, UUID agentID, Caps caps) + { + IClientAPI client; + if (! m_scene.TryGetClient(agentID, out client)) { + m_log.WarnFormat("[LAND] unable to retrieve IClientAPI for {0}", agentID.ToString()); + return LLSDHelpers.SerialiseLLSDReply(new LLSDEmpty()); + } + + ParcelPropertiesUpdateMessage properties = new ParcelPropertiesUpdateMessage(); + OpenMetaverse.StructuredData.OSDMap args = (OpenMetaverse.StructuredData.OSDMap) OSDParser.DeserializeLLSDXml(request); + + properties.Deserialize(args); + + LandUpdateArgs land_update = new LandUpdateArgs(); + int parcelID = properties.LocalID; + land_update.AuthBuyerID = properties.AuthBuyerID; land_update.Category = properties.Category; land_update.Desc = properties.Desc; land_update.GroupID = properties.GroupID; @@ -1399,15 +1394,15 @@ namespace OpenSim.Region.CoreModules.World.Land land_update.SnapshotID = properties.SnapshotID; land_update.UserLocation = properties.UserLocation; land_update.UserLookAt = properties.UserLookAt; - land_update.MediaDescription = properties.MediaDesc; - land_update.MediaType = properties.MediaType; - land_update.MediaWidth = properties.MediaWidth; - land_update.MediaHeight = properties.MediaHeight; - land_update.MediaLoop = properties.MediaLoop; - land_update.ObscureMusic = properties.ObscureMusic; - land_update.ObscureMedia = properties.ObscureMedia; - - ILandObject land; + land_update.MediaDescription = properties.MediaDesc; + land_update.MediaType = properties.MediaType; + land_update.MediaWidth = properties.MediaWidth; + land_update.MediaHeight = properties.MediaHeight; + land_update.MediaLoop = properties.MediaLoop; + land_update.ObscureMusic = properties.ObscureMusic; + land_update.ObscureMedia = properties.ObscureMedia; + + ILandObject land; lock (m_landList) { m_landList.TryGetValue(parcelID, out land); @@ -1415,15 +1410,15 @@ namespace OpenSim.Region.CoreModules.World.Land if (land != null) { - land.UpdateLandProperties(land_update, client); + land.UpdateLandProperties(land_update, client); m_scene.EventManager.TriggerOnParcelPropertiesUpdateRequest(land_update, parcelID, client); - } + } else { - m_log.WarnFormat("[LAND] unable to find parcelID {0}", parcelID); - } + m_log.WarnFormat("[LAND] unable to find parcelID {0}", parcelID); + } return LLSDHelpers.SerialiseLLSDReply(new LLSDEmpty()); - } + } // we cheat here: As we don't have (and want) a grid-global parcel-store, we can't return the // "real" parcelID, because we wouldn't be able to map that to the region the parcel belongs to. // So, we create a "fake" parcelID by using the regionHandle (64 bit), and the local (integer) x @@ -1500,19 +1495,19 @@ namespace OpenSim.Region.CoreModules.World.Land if (parcelID == UUID.Zero) return; - ExtendedLandData data = - (ExtendedLandData)parcelInfoCache.Get(parcelID.ToString(), - delegate(string id) + ExtendedLandData data = + (ExtendedLandData)parcelInfoCache.Get(parcelID.ToString(), + delegate(string id) { UUID parcel = UUID.Zero; UUID.TryParse(id, out parcel); // assume we've got the parcelID we just computed in RemoteParcelRequest ExtendedLandData extLandData = new ExtendedLandData(); - Util.ParseFakeParcelID(parcel, out extLandData.RegionHandle, + Util.ParseFakeParcelID(parcel, out extLandData.RegionHandle, out extLandData.X, out extLandData.Y); m_log.DebugFormat("[LAND] got parcelinfo request for regionHandle {0}, x/y {1}/{2}", extLandData.RegionHandle, extLandData.X, extLandData.Y); - + // for this region or for somewhere else? if (extLandData.RegionHandle == m_scene.RegionInfo.RegionHandle) { diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs index 499b60c..d87352f 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs @@ -229,13 +229,13 @@ namespace OpenSim.Region.CoreModules.World.Land newData.SnapshotID = args.SnapshotID; newData.UserLocation = args.UserLocation; newData.UserLookAt = args.UserLookAt; - newData.MediaType = args.MediaType; - newData.MediaDescription = args.MediaDescription; - newData.MediaWidth = args.MediaWidth; - newData.MediaHeight = args.MediaHeight; - newData.MediaLoop = args.MediaLoop; - newData.ObscureMusic = args.ObscureMusic; - newData.ObscureMedia = args.ObscureMedia; + newData.MediaType = args.MediaType; + newData.MediaDescription = args.MediaDescription; + newData.MediaWidth = args.MediaWidth; + newData.MediaHeight = args.MediaHeight; + newData.MediaLoop = args.MediaLoop; + newData.ObscureMusic = args.ObscureMusic; + newData.ObscureMedia = args.ObscureMedia; m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData); diff --git a/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs b/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs index 82ad109..7c5d044 100644 --- a/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs +++ b/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs @@ -54,11 +54,11 @@ namespace OpenSim.Region.CoreModules.Media.Moap { [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "MoapModule")] public class MoapModule : INonSharedRegionModule, IMoapModule - { + { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - public string Name { get { return "MoapModule"; } } - public Type ReplaceableInterface { get { return null; } } + public string Name { get { return "MoapModule"; } } + public Type ReplaceableInterface { get { return null; } } /// /// Is this module enabled? @@ -78,17 +78,17 @@ namespace OpenSim.Region.CoreModules.Media.Moap /// /// Track the ObjectMedia capabilities given to users keyed by agent. Lock m_omCapUsers to manipulate. /// - protected Dictionary m_omCapUrls = new Dictionary(); + protected Dictionary m_omCapUrls = new Dictionary(); /// /// Track the ObjectMediaUpdate capabilities given to users keyed by path - /// + /// protected Dictionary m_omuCapUsers = new Dictionary(); /// /// Track the ObjectMediaUpdate capabilities given to users keyed by agent. Lock m_omuCapUsers to manipulate - /// - protected Dictionary m_omuCapUrls = new Dictionary(); + /// + protected Dictionary m_omuCapUrls = new Dictionary(); public void Initialise(IConfigSource configSource) { @@ -129,7 +129,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap m_scene.EventManager.OnRegisterCaps -= OnRegisterCaps; m_scene.EventManager.OnDeregisterCaps -= OnDeregisterCaps; m_scene.EventManager.OnSceneObjectPartCopy -= OnSceneObjectPartCopy; - } + } public void OnRegisterCaps(UUID agentID, Caps caps) { @@ -159,7 +159,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap caps.RegisterHandler( "ObjectMediaNavigate", new RestStreamHandler("POST", omuCapUrl, HandleObjectMediaNavigateMessage)); } - } + } public void OnDeregisterCaps(UUID agentID, Caps caps) { @@ -179,7 +179,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap } protected void OnSceneObjectPartCopy(SceneObjectPart copy, SceneObjectPart original, bool userExposed) - { + { if (original.Shape.Media != null) { PrimitiveBaseShape.MediaList dupeMedia = new PrimitiveBaseShape.MediaList(); @@ -195,7 +195,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap } copy.Shape.Media = dupeMedia; - } + } } public MediaEntry GetMediaEntry(SceneObjectPart part, int face) @@ -211,9 +211,9 @@ namespace OpenSim.Region.CoreModules.Media.Moap me = null; } else - { + { lock (media) - me = media[face]; + me = media[face]; // TODO: Really need a proper copy constructor down in libopenmetaverse if (me != null) @@ -227,17 +227,17 @@ namespace OpenSim.Region.CoreModules.Media.Moap public void SetMediaEntry(SceneObjectPart part, int face, MediaEntry me) { - CheckFaceParam(part, face); + CheckFaceParam(part, face); if (null == part.Shape.Media) part.Shape.Media = new PrimitiveBaseShape.MediaList(new MediaEntry[part.GetNumberOfSides()]); - lock (part.Shape.Media) + lock (part.Shape.Media) part.Shape.Media[face] = me; - UpdateMediaUrl(part, UUID.Zero); + UpdateMediaUrl(part, UUID.Zero); part.ScheduleFullUpdate(); - part.TriggerScriptChangedEvent(Changed.MEDIA); + part.TriggerScriptChangedEvent(Changed.MEDIA); } public void ClearMediaEntry(SceneObjectPart part, int face) @@ -256,7 +256,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap /// protected string HandleObjectMediaMessage( string request, string path, string param, OSHttpRequest httpRequest, OSHttpResponse httpResponse) - { + { // m_log.DebugFormat("[MOAP]: Got ObjectMedia path [{0}], raw request [{1}]", path, request); OSDMap osd = (OSDMap)OSDParser.DeserializeLLSDXml(request); @@ -266,12 +266,12 @@ namespace OpenSim.Region.CoreModules.Media.Moap if (omm.Request is ObjectMediaRequest) return HandleObjectMediaRequest(omm.Request as ObjectMediaRequest); else if (omm.Request is ObjectMediaUpdate) - return HandleObjectMediaUpdate(path, omm.Request as ObjectMediaUpdate); + return HandleObjectMediaUpdate(path, omm.Request as ObjectMediaUpdate); throw new Exception( string.Format( "[MOAP]: ObjectMediaMessage has unrecognized ObjectMediaBlock of {0}", - omm.Request.GetType())); + omm.Request.GetType())); } /// @@ -279,7 +279,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap /// /// /// - protected string HandleObjectMediaRequest(ObjectMediaRequest omr) + protected string HandleObjectMediaRequest(ObjectMediaRequest omr) { UUID primId = omr.PrimID; @@ -318,7 +318,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap /// Path on which this request was made /// /param> /// - protected string HandleObjectMediaUpdate(string path, ObjectMediaUpdate omu) + protected string HandleObjectMediaUpdate(string path, ObjectMediaUpdate omu) { UUID primId = omu.PrimID; @@ -330,9 +330,9 @@ namespace OpenSim.Region.CoreModules.Media.Moap "[MOAP]: Received an UPDATE ObjectMediaRequest for prim {0} but this doesn't exist in region {1}", primId, m_scene.RegionInfo.RegionName); return string.Empty; - } + } -// m_log.DebugFormat("[MOAP]: Received {0} media entries for prim {1}", omu.FaceMedia.Length, primId); +// m_log.DebugFormat("[MOAP]: Received {0} media entries for prim {1}", omu.FaceMedia.Length, primId); // for (int i = 0; i < omu.FaceMedia.Length; i++) // { @@ -374,14 +374,14 @@ namespace OpenSim.Region.CoreModules.Media.Moap part.Shape.Textures = te; // m_log.DebugFormat( // "[MOAP]: Media flags for face {0} is {1}", -// i, part.Shape.Textures.FaceTextures[i].MediaFlags); +// i, part.Shape.Textures.FaceTextures[i].MediaFlags); } } } else - { + { // We need to go through the media textures one at a time to make sure that we have permission - // to change them + // to change them // FIXME: Race condition here since some other texture entry manipulator may overwrite/get // overwritten. Unfortunately, PrimitiveBaseShape does not allow us to change texture entry @@ -391,18 +391,18 @@ namespace OpenSim.Region.CoreModules.Media.Moap lock (media) { for (int i = 0; i < media.Count; i++) - { + { if (m_scene.Permissions.CanControlPrimMedia(agentId, part.UUID, i)) - { + { media[i] = omu.FaceMedia[i]; // When a face is cleared this is done by setting the MediaFlags in the TextureEntry via a normal // texture update, so we don't need to worry about clearing MediaFlags here. if (null == media[i]) - continue; + continue; Primitive.TextureEntryFace face = te.CreateFace((uint)i); - face.MediaFlags = true; + face.MediaFlags = true; // m_log.DebugFormat( // "[MOAP]: Media flags for face {0} is {1}", @@ -414,11 +414,11 @@ namespace OpenSim.Region.CoreModules.Media.Moap part.Shape.Textures = te; -// for (int i2 = 0; i2 < part.Shape.Textures.FaceTextures.Length; i2++) -// m_log.DebugFormat("[MOAP]: FaceTexture[{0}] is {1}", i2, part.Shape.Textures.FaceTextures[i2]); +// for (int i2 = 0; i2 < part.Shape.Textures.FaceTextures.Length; i2++) +// m_log.DebugFormat("[MOAP]: FaceTexture[{0}] is {1}", i2, part.Shape.Textures.FaceTextures[i2]); } - UpdateMediaUrl(part, agentId); + UpdateMediaUrl(part, agentId); // Arguably, we could avoid sending a full update to the avatar that just changed the texture. part.ScheduleFullUpdate(); @@ -439,16 +439,16 @@ namespace OpenSim.Region.CoreModules.Media.Moap /// protected string HandleObjectMediaNavigateMessage( string request, string path, string param, OSHttpRequest httpRequest, OSHttpResponse httpResponse) - { + { // m_log.DebugFormat("[MOAP]: Got ObjectMediaNavigate request [{0}]", request); OSDMap osd = (OSDMap)OSDParser.DeserializeLLSDXml(request); ObjectMediaNavigateMessage omn = new ObjectMediaNavigateMessage(); - omn.Deserialize(osd); + omn.Deserialize(osd); UUID primId = omn.PrimID; - SceneObjectPart part = m_scene.GetSceneObjectPart(primId); + SceneObjectPart part = m_scene.GetSceneObjectPart(primId); if (null == part) { @@ -456,12 +456,12 @@ namespace OpenSim.Region.CoreModules.Media.Moap "[MOAP]: Received an ObjectMediaNavigateMessage for prim {0} but this doesn't exist in region {1}", primId, m_scene.RegionInfo.RegionName); return string.Empty; - } + } UUID agentId = default(UUID); lock (m_omuCapUsers) - agentId = m_omuCapUsers[path]; + agentId = m_omuCapUsers[path]; if (!m_scene.Permissions.CanInteractWithPrimMedia(agentId, part.UUID, omn.Face)) return string.Empty; @@ -484,7 +484,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap return string.Empty; if (me.EnableWhiteList) - { + { if (!CheckUrlAgainstWhitelist(omn.URL, me.WhiteList)) { // m_log.DebugFormat( @@ -493,18 +493,18 @@ namespace OpenSim.Region.CoreModules.Media.Moap return string.Empty; } - } + } me.CurrentURL = omn.URL; UpdateMediaUrl(part, agentId); - part.ScheduleFullUpdate(); + part.ScheduleFullUpdate(); part.TriggerScriptChangedEvent(Changed.MEDIA); return OSDParser.SerializeLLSDXmlString(new OSD()); - } + } /// /// Check that the face number is valid for the given prim. @@ -519,7 +519,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap int maxFaces = part.GetNumberOfSides() - 1; if (face > maxFaces) throw new ArgumentException( - string.Format("Face argument was {0} but max is {1}", face, maxFaces)); + string.Format("Face argument was {0} but max is {1}", face, maxFaces)); } /// @@ -542,9 +542,9 @@ namespace OpenSim.Region.CoreModules.Media.Moap string rawVersion = part.MediaUrl.Substring(5, 10); int version = int.Parse(rawVersion); part.MediaUrl = string.Format("x-mv:{0:D10}/{1}", ++version, updateId); - } + } -// m_log.DebugFormat("[MOAP]: Storing media url [{0}] in prim {1} {2}", part.MediaUrl, part.Name, part.UUID); +// m_log.DebugFormat("[MOAP]: Storing media url [{0}] in prim {1} {2}", part.MediaUrl, part.Name, part.UUID); } /// @@ -554,7 +554,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap /// /// true if the url matches an entry on the whitelist, false otherwise protected bool CheckUrlAgainstWhitelist(string rawUrl, string[] whitelist) - { + { Uri url = new Uri(rawUrl); foreach (string origWlUrl in whitelist) @@ -575,7 +575,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap if (url.Host.Contains(wlUrl)) { // m_log.DebugFormat("[MOAP]: Whitelist URL {0} matches {1}", origWlUrl, rawUrl); - return true; + return true; } } else @@ -588,7 +588,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap return true; } } - } + } return false; } diff --git a/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs b/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs index 12750c5..db50339 100644 --- a/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs +++ b/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs @@ -49,8 +49,8 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell protected Scene m_scene = null; protected IDialogModule m_dialogModule; - public string Name { get { return "Object BuySell Module"; } } - public Type ReplaceableInterface { get { return null; } } + public string Name { get { return "Object BuySell Module"; } } + public Type ReplaceableInterface { get { return null; } } public void Initialise(IConfigSource source) {} @@ -78,8 +78,8 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell public void SubscribeToClientEvents(IClientAPI client) { - client.OnObjectSaleInfo += ObjectSaleInfo; - } + client.OnObjectSaleInfo += ObjectSaleInfo; + } protected void ObjectSaleInfo( IClientAPI client, UUID agentID, UUID sessionID, uint localID, byte saleType, int salePrice) @@ -99,7 +99,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell part.ParentGroup.HasGroupChanged = true; part.GetProperties(client); - } + } public bool BuyObject(IClientAPI remoteClient, UUID categoryID, uint localID, byte saleType) { @@ -225,7 +225,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell } else { - if (m_dialogModule != null) + if (m_dialogModule != null) m_dialogModule.SendAlertToUser(remoteClient, "Cannot buy now. Your inventory is unavailable"); return false; } @@ -261,6 +261,6 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell } return true; - } + } } } \ No newline at end of file diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs index bc54997..573a22a 100644 --- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs +++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs @@ -397,13 +397,13 @@ namespace OpenSim.Region.CoreModules.World.Permissions m_groupsModule = m_scene.RequestModuleInterface(); if (m_groupsModule == null) - m_log.Warn("[PERMISSIONS]: Groups module not found, group permissions will not work"); + m_log.Warn("[PERMISSIONS]: Groups module not found, group permissions will not work"); m_moapModule = m_scene.RequestModuleInterface(); // This log line will be commented out when no longer required for debugging // if (m_moapModule == null) -// m_log.Warn("[PERMISSIONS]: Media on a prim module not found, media on a prim permissions will not work"); +// m_log.Warn("[PERMISSIONS]: Media on a prim module not found, media on a prim permissions will not work"); } public void Close() @@ -1906,7 +1906,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions } private bool CanControlPrimMedia(UUID agentID, UUID primID, int face) - { + { // m_log.DebugFormat( // "[PERMISSONS]: Performing CanControlPrimMedia check with agentID {0}, primID {1}, face {2}", // agentID, primID, face); @@ -1918,7 +1918,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions if (null == part) return false; - MediaEntry me = m_moapModule.GetMediaEntry(part, face); + MediaEntry me = m_moapModule.GetMediaEntry(part, face); // If there is no existing media entry then it can be controlled (in this context, created). if (null == me) @@ -1929,7 +1929,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions // agentID, primID, face, me.ControlPermissions); return GenericPrimMediaPermission(part, agentID, me.ControlPermissions); - } + } private bool CanInteractWithPrimMedia(UUID agentID, UUID primID, int face) { @@ -1952,15 +1952,15 @@ namespace OpenSim.Region.CoreModules.World.Permissions // m_log.DebugFormat( // "[PERMISSIONS]: Checking CanInteractWithPrimMedia for {0} on {1} face {2} with interact permissions {3}", -// agentID, primID, face, me.InteractPermissions); +// agentID, primID, face, me.InteractPermissions); return GenericPrimMediaPermission(part, agentID, me.InteractPermissions); - } + } private bool GenericPrimMediaPermission(SceneObjectPart part, UUID agentID, MediaPermission perms) { // if (IsAdministrator(agentID)) -// return true; +// return true; if ((perms & MediaPermission.Anyone) == MediaPermission.Anyone) return true; @@ -1969,15 +1969,15 @@ namespace OpenSim.Region.CoreModules.World.Permissions { if (agentID == part.OwnerID) return true; - } + } if ((perms & MediaPermission.Group) == MediaPermission.Group) { if (IsGroupMember(part.GroupID, agentID, 0)) return true; - } + } - return false; + return false; } } } \ No newline at end of file diff --git a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs index cb80111..25d73c2 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs @@ -814,7 +814,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain { //m_log.Debug("Terrain packet unacked, resending patch: " + patchX + " , " + patchY); client.SendLayerData(patchX, patchY, m_scene.Heightmap.GetFloatsSerialised()); - } + } private void StoreUndoState() { diff --git a/OpenSim/Region/CoreModules/World/Wind/WindModule.cs b/OpenSim/Region/CoreModules/World/Wind/WindModule.cs index 9736b73..6bac555 100644 --- a/OpenSim/Region/CoreModules/World/Wind/WindModule.cs +++ b/OpenSim/Region/CoreModules/World/Wind/WindModule.cs @@ -425,7 +425,7 @@ namespace OpenSim.Region.CoreModules { if (m_ready) { - if(m_scene.GetRootAgentCount() > 0) + if (m_scene.GetRootAgentCount() > 0) { // Ask wind plugin to generate a LL wind array to be cached locally // Try not to update this too often, as it may involve array copies diff --git a/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs index 1d9c2bd..1bd1371 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs @@ -228,7 +228,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap SceneObjectGroup mapdot = (SceneObjectGroup)obj; Color mapdotspot = Color.Gray; // Default color when prim color is white - // Loop over prim in group + // Loop over prim in group List partList = null; lock (mapdot.Children) partList = new List(mapdot.Children.Values); diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs index f036d85..fbc8a50 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs @@ -307,7 +307,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap lock (m_rootAgents) { m_rootAgents.Remove(AgentId); - if(m_rootAgents.Count == 0) + if (m_rootAgents.Count == 0) StopThread(); } } -- cgit v1.1