From eabd8cbe48b2b4af3fc9c04b695f4d5ebe561fcb Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 18 Dec 2016 07:11:20 +0000 Subject: a few updates to contributors list (sorry the ones still missing) --- CONTRIBUTORS.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt index db2f16b..d540c07 100644 --- a/CONTRIBUTORS.txt +++ b/CONTRIBUTORS.txt @@ -89,6 +89,7 @@ what it is today. * dmiles (Daxtron Labs) * Dong Jun Lan (IBM) * DoranZemlja +* Drake Arconis * dr0b3rts * dslake * eeyore @@ -107,6 +108,7 @@ what it is today. * Flyte Xevious * Freaky Tech * Garmin Kawaguichi +* Geir Noklebye * Glenn Martin (MOSES) * Gryc Ueusp * H-H-H (ginge264) @@ -115,6 +117,7 @@ what it is today. * Imaze Rhiano * Intimidated * Jak Daniels +* Jeff Kelly * Jeremy Bongio (IBM) * jhurliman * John R Sohn (XenReborn) @@ -136,6 +139,7 @@ what it is today. * Magnuz Binder * maimedleech * Mana Janus +* Mandarinka Tasty * MarcelEdward * Matt Lehmann * Mic Bowman @@ -158,6 +162,7 @@ what it is today. * openlifegrid.com * otakup0pe * Pixel Tomsen +* Quill Littlefeather * ralphos * RemedyTomm * Revolution @@ -183,6 +188,7 @@ what it is today. * TBG Renfold * tglion * tlaukkan/Tommil (Tommi S. E. Laukkanen, Bubble Cloud) +* TomDataWorks * TomTheDragon (muckwaddle) * tyre * Vegaslon -- cgit v1.1 From e40820cab16500c6aac2aa25d1ea0cdc6725c392 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Tue, 20 Dec 2016 17:01:48 +0000 Subject: Remove obsolete "gridmode" config default in code. --- OpenSim/Tools/Configger/ConfigurationLoader.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/OpenSim/Tools/Configger/ConfigurationLoader.cs b/OpenSim/Tools/Configger/ConfigurationLoader.cs index 4190f10..31ae923 100644 --- a/OpenSim/Tools/Configger/ConfigurationLoader.cs +++ b/OpenSim/Tools/Configger/ConfigurationLoader.cs @@ -264,7 +264,6 @@ namespace OpenSim.Tools.Configger config.Set("region_info_source", "filesystem"); config.Set("allow_regionless", false); - config.Set("gridmode", false); config.Set("physics", "OpenDynamicsEngine"); config.Set("meshing", "Meshmerizer"); config.Set("physical_prim", true); @@ -281,4 +280,4 @@ namespace OpenSim.Tools.Configger return defaultConfig; } } -} \ No newline at end of file +} -- cgit v1.1 From 66c18438f21737d2ea6dc3af726bc8950506e2e8 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Tue, 20 Dec 2016 17:08:15 +0000 Subject: remove obsolete config option "storage_prim_inventories" --- OpenSim/Region/Application/ConfigurationLoader.cs | 3 +-- OpenSim/Tools/Configger/ConfigurationLoader.cs | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/OpenSim/Region/Application/ConfigurationLoader.cs b/OpenSim/Region/Application/ConfigurationLoader.cs index b19e549..522fe0e 100644 --- a/OpenSim/Region/Application/ConfigurationLoader.cs +++ b/OpenSim/Region/Application/ConfigurationLoader.cs @@ -348,7 +348,6 @@ namespace OpenSim config.Set("meshing", "Meshmerizer"); config.Set("physical_prim", true); config.Set("serverside_object_permissions", true); - config.Set("storage_prim_inventories", true); config.Set("startup_console_commands_file", String.Empty); config.Set("shutdown_console_commands_file", String.Empty); config.Set("DefaultScriptEngine", "XEngine"); @@ -387,4 +386,4 @@ namespace OpenSim m_networkServersInfo.loadFromConfiguration(m_config.Source); } } -} \ No newline at end of file +} diff --git a/OpenSim/Tools/Configger/ConfigurationLoader.cs b/OpenSim/Tools/Configger/ConfigurationLoader.cs index 31ae923..aba7e64 100644 --- a/OpenSim/Tools/Configger/ConfigurationLoader.cs +++ b/OpenSim/Tools/Configger/ConfigurationLoader.cs @@ -268,7 +268,6 @@ namespace OpenSim.Tools.Configger config.Set("meshing", "Meshmerizer"); config.Set("physical_prim", true); config.Set("serverside_object_permissions", true); - config.Set("storage_prim_inventories", true); config.Set("startup_console_commands_file", String.Empty); config.Set("shutdown_console_commands_file", String.Empty); config.Set("DefaultScriptEngine", "XEngine"); -- cgit v1.1 From 90be8d78c31d583eedd591f6c569efc38960e1dc Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Tue, 20 Dec 2016 17:10:33 +0000 Subject: Remove obsolete config option "EventQueue". It's been always on for ages! --- OpenSim/Region/Application/ConfigurationLoader.cs | 2 -- .../Region/ClientStack/Linden/Caps/EventQueue/Tests/EventQueueTests.cs | 3 +-- OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs | 1 - OpenSim/Tools/Configger/ConfigurationLoader.cs | 2 -- 4 files changed, 1 insertion(+), 7 deletions(-) diff --git a/OpenSim/Region/Application/ConfigurationLoader.cs b/OpenSim/Region/Application/ConfigurationLoader.cs index 522fe0e..4f141a6 100644 --- a/OpenSim/Region/Application/ConfigurationLoader.cs +++ b/OpenSim/Region/Application/ConfigurationLoader.cs @@ -352,8 +352,6 @@ namespace OpenSim config.Set("shutdown_console_commands_file", String.Empty); config.Set("DefaultScriptEngine", "XEngine"); config.Set("clientstack_plugin", "OpenSim.Region.ClientStack.LindenUDP.dll"); - // life doesn't really work without this - config.Set("EventQueue", true); } { diff --git a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/Tests/EventQueueTests.cs b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/Tests/EventQueueTests.cs index 5eb4452..1e629bd 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/Tests/EventQueueTests.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/Tests/EventQueueTests.cs @@ -71,7 +71,6 @@ namespace OpenSim.Region.ClientStack.Linden.Tests IConfigSource config = new IniConfigSource(); config.AddConfig("Startup"); - config.Configs["Startup"].Set("EventQueue", "true"); CapabilitiesModule capsModule = new CapabilitiesModule(); m_eqgMod = new EventQueueGetModule(); @@ -196,4 +195,4 @@ namespace OpenSim.Region.ClientStack.Linden.Tests Assert.That((int)eventsResponse["int_response_code"], Is.EqualTo((int)HttpStatusCode.BadGateway)); } } -} \ No newline at end of file +} diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs index 568cd34..ada407f 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs @@ -271,7 +271,6 @@ namespace OpenSim.Region.Framework.Scenes.Tests IConfigSource configSource = new IniConfigSource(); IConfig config = configSource.AddConfig("Startup"); config.Set("serverside_object_permissions", true); - config.Set("EventQueue", true); EntityTransferModule etm = new EntityTransferModule(); diff --git a/OpenSim/Tools/Configger/ConfigurationLoader.cs b/OpenSim/Tools/Configger/ConfigurationLoader.cs index aba7e64..fa3a5bf 100644 --- a/OpenSim/Tools/Configger/ConfigurationLoader.cs +++ b/OpenSim/Tools/Configger/ConfigurationLoader.cs @@ -272,8 +272,6 @@ namespace OpenSim.Tools.Configger config.Set("shutdown_console_commands_file", String.Empty); config.Set("DefaultScriptEngine", "XEngine"); config.Set("clientstack_plugin", "OpenSim.Region.ClientStack.LindenUDP.dll"); - // life doesn't really work without this - config.Set("EventQueue", true); } return defaultConfig; -- cgit v1.1 From 7286b27ff93f566596310fc16e46d95abfa3502e Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Wed, 21 Dec 2016 14:35:34 +0000 Subject: Add GRID_GOD to the list of values allowed for enabling OSSL functions --- .../Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index c83682e..c6a4050 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -310,7 +310,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api foreach (string id in ids) { string current = id.Trim(); - if (current.ToUpper() == "PARCEL_GROUP_MEMBER" || current.ToUpper() == "PARCEL_OWNER" || current.ToUpper() == "ESTATE_MANAGER" || current.ToUpper() == "ESTATE_OWNER") + if (current.ToUpper() == "PARCEL_GROUP_MEMBER" || current.ToUpper() == "PARCEL_OWNER" || current.ToUpper() == "ESTATE_MANAGER" || current.ToUpper() == "ESTATE_OWNER" || current.ToUpper() == "GRID_GOD") { if (!perms.AllowedOwnerClasses.Contains(current)) perms.AllowedOwnerClasses.Add(current.ToUpper()); @@ -415,6 +415,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } + //Only gods may use the function + if (m_FunctionPerms[function].AllowedOwnerClasses.Contains("GRID_GOD")) + { + if (World.Permissions.IsAdministrator(ownerID)) + { + return String.Empty; + } + } + if (!m_FunctionPerms[function].AllowedCreators.Contains(m_item.CreatorID)) return( String.Format("{0} permission denied. Script creator is not in the list of users allowed to execute this function and prim owner also has no permission.", -- cgit v1.1 From 7367f03d6e990983c9ff6e3f5da11a1fe804b632 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 21 Dec 2016 20:39:38 +0000 Subject: remove a odd raycastv3 config option --- .../Shared/Api/Implementation/LSL_Api.cs | 36 +++++++++------------- bin/OpenSimDefaults.ini | 3 -- 2 files changed, 14 insertions(+), 25 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index eeaec42..5269bf9 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -233,7 +233,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api protected int m_maxHitsPerPrimInCastRay = 16; protected int m_maxHitsPerObjectInCastRay = 16; protected bool m_detectExitsInCastRay = false; - protected bool m_filterPartsInCastRay = false; protected bool m_doAttachmentsInCastRay = false; protected int m_msThrottleInCastRay = 200; protected int m_msPerRegionInCastRay = 40; @@ -391,7 +390,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_maxHitsPerPrimInCastRay = lslConfig.GetInt("MaxHitsPerPrimInLlCastRay", m_maxHitsPerPrimInCastRay); m_maxHitsPerObjectInCastRay = lslConfig.GetInt("MaxHitsPerObjectInLlCastRay", m_maxHitsPerObjectInCastRay); m_detectExitsInCastRay = lslConfig.GetBoolean("DetectExitHitsInLlCastRay", m_detectExitsInCastRay); - m_filterPartsInCastRay = lslConfig.GetBoolean("FilterPartsInLlCastRay", m_filterPartsInCastRay); m_doAttachmentsInCastRay = lslConfig.GetBoolean("DoAttachmentsInLlCastRay", m_doAttachmentsInCastRay); m_msThrottleInCastRay = lslConfig.GetInt("ThrottleTimeInMsInLlCastRay", m_msThrottleInCastRay); m_msPerRegionInCastRay = lslConfig.GetInt("AvailableTimeInMsPerRegionInLlCastRay", m_msPerRegionInCastRay); @@ -15063,8 +15061,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return; if (isPhantom && notdetectPhantom) return; - if (m_filterPartsInCastRay) - return; if (isAttachment && !m_doAttachmentsInCastRay) return; @@ -15072,25 +15068,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // Iterate over all prims/parts in object/group foreach(SceneObjectPart part in group.Parts) { - // Check part filters if configured - if (m_filterPartsInCastRay) - { - // ignore PhysicsShapeType.None as physics engines do - // or we will get into trouble in future - if(part.PhysicsShapeType == (byte)PhysicsShapeType.None) - continue; - isPhysical = (part.PhysActor != null && part.PhysActor.IsPhysical); - isNonphysical = !isPhysical; - isPhantom = ((part.Flags & PrimFlags.Phantom) != 0) || - (part.VolumeDetectActive); + // ignore PhysicsShapeType.None as physics engines do + // or we will get into trouble in future + if(part.PhysicsShapeType == (byte)PhysicsShapeType.None) + continue; + isPhysical = (part.PhysActor != null && part.PhysActor.IsPhysical); + isNonphysical = !isPhysical; + isPhantom = ((part.Flags & PrimFlags.Phantom) != 0) || + (part.VolumeDetectActive); - if (isPhysical && rejectPhysical) - continue; - if (isNonphysical && rejectNonphysical) - continue; - if (isPhantom && notdetectPhantom) - continue; - } + if (isPhysical && rejectPhysical) + continue; + if (isNonphysical && rejectNonphysical) + continue; + if (isPhantom && notdetectPhantom) + continue; // Parse prim/part and project ray if passed filters Vector3 scalePart = part.Scale; diff --git a/bin/OpenSimDefaults.ini b/bin/OpenSimDefaults.ini index b133da9..644391f 100644 --- a/bin/OpenSimDefaults.ini +++ b/bin/OpenSimDefaults.ini @@ -1635,9 +1635,6 @@ ; Report ray intersections with surfaces on exits from a prim as hits in llCastRay V3 if true DetectExitHitsInLlCastRay = false - ; Filter on parts instead of groups in llCastRay V3 if true - FilterPartsInLlCastRay = false - ; Detect attachments in llCastRay V3 if true DoAttachmentsInLlCastRay = false -- cgit v1.1 From 2bfbd6ef2e2628d130f5c8ba502f2247d074ce55 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Wed, 21 Dec 2016 20:56:28 +0000 Subject: Change GRID_GOD script permission to do what it says on the tin. Suggested by Mandarinka --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index c6a4050..5638f01 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -418,7 +418,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api //Only gods may use the function if (m_FunctionPerms[function].AllowedOwnerClasses.Contains("GRID_GOD")) { - if (World.Permissions.IsAdministrator(ownerID)) + if (World.Permissions.IsGridGod(ownerID)) { return String.Empty; } -- cgit v1.1 From 330369f90445bf7a017d25bbf8de647db9621f25 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 21 Dec 2016 22:27:48 +0000 Subject: take UserProfileModule out on onMakeRoot event, add some caching --- OpenSim/Framework/UserProfiles.cs | 14 + .../Avatar/UserProfiles/UserProfileModule.cs | 387 ++++++++++++++++----- 2 files changed, 310 insertions(+), 91 deletions(-) diff --git a/OpenSim/Framework/UserProfiles.cs b/OpenSim/Framework/UserProfiles.cs index 98ab651..6d46fe9 100644 --- a/OpenSim/Framework/UserProfiles.cs +++ b/OpenSim/Framework/UserProfiles.cs @@ -27,6 +27,8 @@ using System; using OpenMetaverse; +using System.Collections.Generic; + namespace OpenSim.Framework { @@ -122,5 +124,17 @@ namespace OpenSim.Framework public string UserId = UUID.Zero.ToString(); public string DataVal = string.Empty; } + + public class UserProfileCacheEntry + { + public Dictionary picksList; + public Dictionary picks; + public Dictionary classifiedsLists; + public Dictionary classifieds; + public UserProfileProperties props; + public string born; + public byte[] membershipType; + public uint flags; + } } diff --git a/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs b/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs index 57025bf..3890bb2 100644 --- a/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs @@ -57,6 +57,7 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "UserProfilesModule")] public class UserProfileModule : IProfileModule, INonSharedRegionModule { + const double PROFILECACHEEXPIRE = 300; /// /// Logging /// @@ -67,6 +68,8 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles // count. The entries are removed when the interest count reaches 0. Dictionary m_classifiedCache = new Dictionary(); Dictionary m_classifiedInterest = new Dictionary(); + ExpiringCache m_profilesCache = new ExpiringCache(); + IImprovedAssetCache m_assetCache; private JsonRpcRequestManager rpc = new JsonRpcRequestManager(); private bool m_allowUserProfileWebURLs = true; @@ -128,7 +131,6 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles get; private set; } - #region IRegionModuleBase implementation /// /// This is called to initialize the region module. For shared modules, this is called exactly once, after @@ -185,22 +187,11 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles Scene = scene; Scene.RegisterModuleInterface(this); Scene.EventManager.OnNewClient += OnNewClient; - Scene.EventManager.OnMakeRootAgent += HandleOnMakeRootAgent; + Scene.EventManager.OnClientClosed += OnClientClosed; UserManagementModule = Scene.RequestModuleInterface(); } - void HandleOnMakeRootAgent (ScenePresence obj) - { - if(obj.PresenceType == PresenceType.Npc) - return; - - Util.FireAndForget(delegate - { - GetImageAssets(((IScenePresence)obj).UUID); - }, null, "UserProfileModule.GetImageAssets"); - } - /// /// Removes the region. /// @@ -211,6 +202,10 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles { if(!Enabled) return; + + m_profilesCache.Clear(); + m_classifiedCache.Clear(); + m_classifiedInterest.Clear(); } /// @@ -226,6 +221,7 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles { if(!Enabled) return; + m_assetCache = Scene.RequestModuleInterface(); } /// @@ -297,6 +293,40 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles client.OnUserInfoRequest += UserPreferencesRequest; client.OnUpdateUserInfo += UpdateUserPreferences; } + + void OnClientClosed(UUID AgentId, Scene scene) + { + ScenePresence sp = scene.GetScenePresence(AgentId); + IClientAPI client = sp.ControllingClient; + if (client == null) + return; + + //Profile + client.OnRequestAvatarProperties -= RequestAvatarProperties; + client.OnUpdateAvatarProperties -= AvatarPropertiesUpdate; + client.OnAvatarInterestUpdate -= AvatarInterestsUpdate; + + // Classifieds +// client.r GenericPacketHandler("avatarclassifiedsrequest", ClassifiedsRequest); + client.OnClassifiedInfoUpdate -= ClassifiedInfoUpdate; + client.OnClassifiedInfoRequest -= ClassifiedInfoRequest; + client.OnClassifiedDelete -= ClassifiedDelete; + + // Picks +// client.AddGenericPacketHandler("avatarpicksrequest", PicksRequest); +// client.AddGenericPacketHandler("pickinforequest", PickInfoRequest); + client.OnPickInfoUpdate -= PickInfoUpdate; + client.OnPickDelete -= PickDelete; + + // Notes +// client.AddGenericPacketHandler("avatarnotesrequest", NotesRequest); + client.OnAvatarNotesUpdate -= NotesUpdate; + + // Preferences + client.OnUserInfoRequest -= UserPreferencesRequest; + client.OnUpdateUserInfo -= UpdateUserPreferences; + } + #endregion Region Event Handlers #region Classified @@ -332,6 +362,34 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles return; } + UserProfileCacheEntry uce = null; + lock(m_profilesCache) + { + if(m_profilesCache.TryGetValue(targetID, out uce) && uce != null) + { + if(uce.classifiedsLists != null) + { + foreach(KeyValuePair kvp in uce.classifiedsLists) + { + UUID kvpkey = kvp.Key; + classifieds[kvpkey] = kvp.Value; + lock (m_classifiedCache) + { + if (!m_classifiedCache.ContainsKey(kvpkey)) + { + m_classifiedCache.Add(kvpkey,targetID); + m_classifiedInterest.Add(kvpkey, 0); + } + + m_classifiedInterest[kvpkey]++; + } + } + remoteClient.SendAvatarClassifiedReply(targetID, uce.classifiedsLists); + return; + } + } + } + string serverURI = string.Empty; GetUserProfileServerURI(targetID, out serverURI); if(string.IsNullOrWhiteSpace(serverURI)) @@ -380,6 +438,13 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles } } + if(uce == null) + uce = new UserProfileCacheEntry(); + uce.classifiedsLists = classifieds; + + lock(m_profilesCache) + m_profilesCache.AddOrUpdate(targetID, uce, PROFILECACHEEXPIRE); + remoteClient.SendAvatarClassifiedReply(targetID, classifieds); } @@ -404,9 +469,29 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles } } } - + + UserProfileCacheEntry uce = null; + lock(m_profilesCache) + { + if(m_profilesCache.TryGetValue(target, out uce) && uce != null) + { + if(uce.classifieds != null && uce.classifieds.ContainsKey(queryClassifiedID)) + { + ad = uce.classifieds[queryClassifiedID]; + Vector3 gPos = new Vector3(); + Vector3.TryParse(ad.GlobalPos, out gPos); + + remoteClient.SendClassifiedInfoReply(ad.ClassifiedId, ad.CreatorId, (uint)ad.CreationDate, + (uint)ad.ExpirationDate, (uint)ad.Category, ad.Name, ad.Description, + ad.ParcelId, (uint)ad.ParentEstate, ad.SnapshotId, ad.SimName, + gPos, ad.ParcelName, ad.Flags, ad.Price); + return; + } + } + } + string serverURI = string.Empty; - GetUserProfileServerURI(target, out serverURI); + bool foreign = GetUserProfileServerURI(target, out serverURI); if(string.IsNullOrWhiteSpace(serverURI)) { return; @@ -424,6 +509,18 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles if(ad.CreatorId == UUID.Zero) return; + if(foreign) + cacheForeignImage(target, ad.SnapshotId); + + if(uce == null) + uce = new UserProfileCacheEntry(); + if(uce.classifieds == null) + uce.classifieds = new Dictionary(); + uce.classifieds[ad.ClassifiedId] = ad; + + lock(m_profilesCache) + m_profilesCache.AddOrUpdate(ad.ClassifiedId, uce, PROFILECACHEEXPIRE); + Vector3 globalPos = new Vector3(); Vector3.TryParse(ad.GlobalPos, out globalPos); @@ -473,6 +570,7 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles uint queryParentEstate, UUID querySnapshotID, Vector3 queryGlobalPos, byte queryclassifiedFlags, int queryclassifiedPrice, IClientAPI remoteClient) { + Scene s = (Scene)remoteClient.Scene; Vector3 pos = remoteClient.SceneAgent.AbsolutePosition; ILandObject land = s.LandChannel.GetLandObject(pos.X, pos.Y); @@ -486,6 +584,17 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles return; } + // just flush cache for now + UserProfileCacheEntry uce = null; + lock(m_profilesCache) + { + if(m_profilesCache.TryGetValue(remoteClient.AgentId, out uce) && uce != null) + { + uce.classifieds = null; + uce.classifiedsLists = null; + } + } + OSDMap parameters = new OSDMap {{"creatorId", OSD.FromUUID(creatorId)}}; OSD Params = (OSD)parameters; if (!rpc.JsonRpcRequest(ref Params, "avatarclassifiedsrequest", serverURI, UUID.Random().ToString())) @@ -549,6 +658,17 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles /// public void ClassifiedDelete(UUID queryClassifiedID, IClientAPI remoteClient) { + // just flush cache for now + UserProfileCacheEntry uce = null; + lock(m_profilesCache) + { + if(m_profilesCache.TryGetValue(remoteClient.AgentId, out uce) && uce != null) + { + uce.classifieds = null; + uce.classifiedsLists = null; + } + } + string serverURI = string.Empty; GetUserProfileServerURI(remoteClient.AgentId, out serverURI); if(string.IsNullOrWhiteSpace(serverURI)) @@ -605,6 +725,19 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles return; } + UserProfileCacheEntry uce = null; + lock(m_profilesCache) + { + if(m_profilesCache.TryGetValue(targetId, out uce) && uce != null) + { + if(uce != null && uce.picksList != null) + { + remoteClient.SendAvatarPicksReply(targetId, uce.picksList); + return; + } + } + } + string serverURI = string.Empty; GetUserProfileServerURI(targetId, out serverURI); if(string.IsNullOrWhiteSpace(serverURI)) @@ -637,6 +770,14 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles string name = m["name"].AsString(); picks[cid] = name; } + + if (uce == null) + uce = new UserProfileCacheEntry(); + uce.picksList = picks; + + lock(m_profilesCache) + m_profilesCache.AddOrUpdate(targetId, uce, PROFILECACHEEXPIRE); + remoteClient.SendAvatarPicksReply(targetId, picks); } @@ -667,8 +808,27 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles if(!UUID.TryParse (args [1], out pick.PickId)) return; + IClientAPI remoteClient = (IClientAPI)sender; + UserProfileCacheEntry uce = null; + lock(m_profilesCache) + { + if(m_profilesCache.TryGetValue(targetID, out uce) && uce != null) + { + if(uce != null && uce.picks != null && uce.picks.ContainsKey(pick.PickId)) + { + pick = uce.picks[pick.PickId]; + Vector3 gPos = new Vector3(Vector3.Zero); + Vector3.TryParse(pick.GlobalPos, out gPos); + remoteClient.SendPickInfoReply(pick.PickId,pick.CreatorId,pick.TopPick,pick.ParcelId,pick.Name, + pick.Desc,pick.SnapshotId,pick.ParcelName,pick.OriginalName,pick.SimName, + gPos,pick.SortOrder,pick.Enabled); + return; + } + } + } + string serverURI = string.Empty; - GetUserProfileServerURI (targetID, out serverURI); + bool foreign = GetUserProfileServerURI (targetID, out serverURI); if(string.IsNullOrWhiteSpace(serverURI)) { return; @@ -676,8 +836,6 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles string theirGatekeeperURI; GetUserGatekeeperURI(targetID, out theirGatekeeperURI); - - IClientAPI remoteClient = (IClientAPI)sender; object Pick = (object)pick; if (!rpc.JsonRpcRequest (ref Pick, "pickinforequest", serverURI, UUID.Random ().ToString ())) { @@ -686,6 +844,8 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles return; } pick = (UserProfilePick)Pick; + if(foreign) + cacheForeignImage(targetID, pick.SnapshotId); Vector3 globalPos = new Vector3(Vector3.Zero); Vector3.TryParse(pick.GlobalPos, out globalPos); @@ -716,6 +876,16 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles m_log.DebugFormat("[PROFILES]: PickInfoRequest: {0} : {1}", pick.Name.ToString(), pick.SnapshotId.ToString()); + pick.GlobalPos = globalPos.ToString(); + if (uce == null) + uce = new UserProfileCacheEntry(); + if(uce.picks == null) + uce.picks = new Dictionary(); + uce.picks[pick.PickId] = pick; + + lock(m_profilesCache) + m_profilesCache.AddOrUpdate(targetID, uce, PROFILECACHEEXPIRE); + // Pull the rabbit out of the hat remoteClient.SendPickInfoReply(pick.PickId,pick.CreatorId,pick.TopPick,pick.ParcelId,pick.Name, pick.Desc,pick.SnapshotId,pick.ParcelName,pick.OriginalName,pick.SimName, @@ -757,6 +927,17 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles //TODO: See how this works with NPC, May need to test m_log.DebugFormat("[PROFILES]: Start PickInfoUpdate Name: {0} PickId: {1} SnapshotId: {2}", name, pickID.ToString(), snapshotID.ToString()); + // flush cache for now + UserProfileCacheEntry uce = null; + lock(m_profilesCache) + { + if(m_profilesCache.TryGetValue(remoteClient.AgentId, out uce) && uce != null) + { + uce.picks = null; + uce.picksList = null; + } + } + UserProfilePick pick = new UserProfilePick(); string serverURI = string.Empty; GetUserProfileServerURI(remoteClient.AgentId, out serverURI); @@ -791,7 +972,6 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles avaPos.X, avaPos.Y, p.Scene.Name); } - pick.PickId = pickID; pick.CreatorId = creatorID; pick.TopPick = topPick; @@ -828,6 +1008,17 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles /// public void PickDelete(IClientAPI remoteClient, UUID queryPickID) { + // flush cache for now + UserProfileCacheEntry uce = null; + lock(m_profilesCache) + { + if(m_profilesCache.TryGetValue(remoteClient.AgentId, out uce) && uce != null) + { + uce.picks = null; + uce.picksList = null; + } + } + string serverURI = string.Empty; GetUserProfileServerURI(remoteClient.AgentId, out serverURI); if(string.IsNullOrWhiteSpace(serverURI)) @@ -1025,6 +1216,16 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles /// public void AvatarInterestsUpdate(IClientAPI remoteClient, uint wantmask, string wanttext, uint skillsmask, string skillstext, string languages) { + // flush cache for now + UserProfileCacheEntry uce = null; + lock(m_profilesCache) + { + if(m_profilesCache.TryGetValue(remoteClient.AgentId, out uce) && uce != null) + { + uce.props = null; + } + } + UserProfileProperties prop = new UserProfileProperties(); prop.UserId = remoteClient.AgentId; @@ -1067,6 +1268,27 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles 0, "Getting into trouble", "Droidspeak"); return; } + UserProfileProperties props; + UserProfileCacheEntry uce = null; + lock(m_profilesCache) + { + if(m_profilesCache.TryGetValue(avatarID, out uce) && uce != null) + { + if(uce.props != null) + { + props = uce.props; + remoteClient.SendAvatarProperties(props.UserId, props.AboutText, + uce.born, uce.membershipType , props.FirstLifeText, uce.flags, + props.FirstLifeImageId, props.ImageId, props.WebUrl, props.PartnerId); + + + remoteClient.SendAvatarInterestsReply(props.UserId, (uint)props.WantToMask, + props.WantToText, (uint)props.SkillsMask, + props.SkillsText, props.Language); + return; + } + } + } string serverURI = string.Empty; bool foreign = GetUserProfileServerURI(avatarID, out serverURI); @@ -1118,13 +1340,13 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles } } - UserProfileProperties props = new UserProfileProperties(); + props = new UserProfileProperties(); props.UserId = avatarID; string result = string.Empty; - if(!GetProfileData(ref props, foreign, out result)) + if(!GetProfileData(ref props, foreign, serverURI, out result)) { - props.AboutText ="Profile not avaible at this time. User may still be unknown to this grid"; + props.AboutText ="Profile not available at this time. User may still be unknown to this grid"; } // if on same region force online @@ -1134,10 +1356,19 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles if(!m_allowUserProfileWebURLs) props.WebUrl =""; + if(uce == null) + uce = new UserProfileCacheEntry(); + uce.props = props; + uce.born = born; + uce.membershipType = membershipType; + uce.flags = flags; + + lock(m_profilesCache) + m_profilesCache.AddOrUpdate(props.UserId, uce, PROFILECACHEEXPIRE); + remoteClient.SendAvatarProperties(props.UserId, props.AboutText, born, membershipType , props.FirstLifeText, flags, props.FirstLifeImageId, props.ImageId, props.WebUrl, props.PartnerId); - remoteClient.SendAvatarInterestsReply(props.UserId, (uint)props.WantToMask, props.WantToText, (uint)props.SkillsMask, props.SkillsText, props.Language); } @@ -1155,6 +1386,16 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles { if (remoteClient.AgentId == newProfile.ID) { + // flush cache for now + UserProfileCacheEntry uce = null; + lock(m_profilesCache) + { + if(m_profilesCache.TryGetValue(remoteClient.AgentId, out uce) && uce != null) + { + uce.props = null; + } + } + UserProfileProperties prop = new UserProfileProperties(); prop.UserId = remoteClient.AgentId; @@ -1189,24 +1430,8 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles /// /// The profile data. /// - bool GetProfileData(ref UserProfileProperties properties, bool foreign, out string message) + bool GetProfileData(ref UserProfileProperties properties, bool foreign, string serverURI, out string message) { - // Can't handle NPC yet... - ScenePresence p = FindPresence(properties.UserId); - - if (null != p) - { - if (p.PresenceType == PresenceType.Npc) - { - message = "Id points to NPC"; - return false; - } - } - - string serverURI = string.Empty; - GetUserProfileServerURI(properties.UserId, out serverURI); - // This is checking a friend on the home grid - // Not HG friend if (String.IsNullOrEmpty(serverURI)) { message = "User profile service unknown at this time"; @@ -1247,10 +1472,14 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles return false; } - // else, continue below } - + properties = (UserProfileProperties)Prop; + if(foreign) + { + cacheForeignImage(properties.UserId, properties.ImageId); + cacheForeignImage(properties.UserId, properties.FirstLifeImageId); + } message = "Success"; return true; @@ -1258,49 +1487,6 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles #endregion Avatar Properties #region Utils - bool GetImageAssets(UUID avatarId) - { - string profileServerURI = string.Empty; - string assetServerURI = string.Empty; - - bool foreign = GetUserProfileServerURI(avatarId, out profileServerURI); - - if(!foreign) - return true; - - assetServerURI = UserManagementModule.GetUserServerURL(avatarId, "AssetServerURI"); - - if(string.IsNullOrEmpty(profileServerURI) || string.IsNullOrEmpty(assetServerURI)) - return false; - - OSDMap parameters= new OSDMap(); - parameters.Add("avatarId", OSD.FromUUID(avatarId)); - OSD Params = (OSD)parameters; - if(!rpc.JsonRpcRequest(ref Params, "image_assets_request", profileServerURI, UUID.Random().ToString())) - { - return false; - } - - parameters = (OSDMap)Params; - - if (parameters.ContainsKey("result")) - { - OSDArray list = (OSDArray)parameters["result"]; - - foreach (OSD asset in list) - { - OSDString assetId = (OSDString)asset; - - Scene.AssetService.Get(string.Format("{0}/{1}", assetServerURI, assetId.AsString())); - } - return true; - } - else - { - m_log.ErrorFormat("[PROFILES]: Problematic response for image_assets_request from {0}", profileServerURI); - return false; - } - } /// /// Gets the user account data. @@ -1451,6 +1637,27 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles } } + void cacheForeignImage(UUID agent, UUID imageID) + { + if(imageID == null || imageID == UUID.Zero) + return; + + string assetServerURI = UserManagementModule.GetUserServerURL(agent, "AssetServerURI"); + if(string.IsNullOrWhiteSpace(assetServerURI)) + return; + + string imageIDstr = imageID.ToString(); + + + if(m_assetCache != null && m_assetCache.Check(imageIDstr)) + return; + + if(Scene.AssetService.Get(imageIDstr) != null) + return; + + Scene.AssetService.Get(string.Format("{0}/{1}", assetServerURI, imageIDstr)); + } + /// /// Finds the presence. /// @@ -1519,9 +1726,8 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles webRequest.ContentType = "application/json-rpc"; webRequest.Method = "POST"; - Stream dataStream = webRequest.GetRequestStream(); - dataStream.Write(content, 0, content.Length); - dataStream.Close(); + using(Stream dataStream = webRequest.GetRequestStream()) + dataStream.Write(content,0,content.Length); WebResponse webResponse = null; try @@ -1601,9 +1807,8 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles webRequest.ContentType = "application/json-rpc"; webRequest.Method = "POST"; - Stream dataStream = webRequest.GetRequestStream(); - dataStream.Write(content, 0, content.Length); - dataStream.Close(); + using(Stream dataStream = webRequest.GetRequestStream()) + dataStream.Write(content,0,content.Length); WebResponse webResponse = null; try -- cgit v1.1 From 5571c499ba1658905c40a1d2d823031591649512 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 22 Dec 2016 07:06:40 +0000 Subject: UserProfileModule we can't use parcels globalID because we do not have a global locator. we need to send replies to viewer on pick update and delete --- .../Avatar/UserProfiles/UserProfileModule.cs | 65 ++++++++++++++-------- 1 file changed, 41 insertions(+), 24 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs b/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs index 3890bb2..7a874e2 100644 --- a/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs @@ -927,17 +927,6 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles //TODO: See how this works with NPC, May need to test m_log.DebugFormat("[PROFILES]: Start PickInfoUpdate Name: {0} PickId: {1} SnapshotId: {2}", name, pickID.ToString(), snapshotID.ToString()); - // flush cache for now - UserProfileCacheEntry uce = null; - lock(m_profilesCache) - { - if(m_profilesCache.TryGetValue(remoteClient.AgentId, out uce) && uce != null) - { - uce.picks = null; - uce.picksList = null; - } - } - UserProfilePick pick = new UserProfilePick(); string serverURI = string.Empty; GetUserProfileServerURI(remoteClient.AgentId, out serverURI); @@ -955,15 +944,19 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles avaPos.Z); string landParcelName = "My Parcel"; - UUID landParcelID = p.currentParcelUUID; +// UUID landParcelID = p.currentParcelUUID; + // to locate parcels we use a fake id that encodes the region handle + // since we do not have a global locator + // this fails on HG + UUID landParcelID = Util.BuildFakeParcelID(remoteClient.Scene.RegionInfo.RegionHandle, (uint)avaPos.X, (uint)avaPos.Y); ILandObject land = p.Scene.LandChannel.GetLandObject(avaPos.X, avaPos.Y); if (land != null) { // If land found, use parcel uuid from here because the value from SP will be blank if the avatar hasnt moved landParcelName = land.LandData.Name; - landParcelID = land.LandData.GlobalID; +// landParcelID = land.LandData.GlobalID; } else { @@ -994,6 +987,24 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles return; } + UserProfileCacheEntry uce = null; + lock(m_profilesCache) + { + if(!m_profilesCache.TryGetValue(remoteClient.AgentId, out uce) || uce == null) + uce = new UserProfileCacheEntry(); + if(uce.picks == null) + uce.picks = new Dictionary(); + if(uce.picksList == null) + uce.picksList = new Dictionary(); + uce.picks[pick.PickId] = pick; + uce.picksList[pick.PickId] = pick.Name; + m_profilesCache.AddOrUpdate(remoteClient.AgentId, uce, PROFILECACHEEXPIRE); + } + remoteClient.SendAvatarPicksReply(remoteClient.AgentId, uce.picksList); + remoteClient.SendPickInfoReply(pick.PickId,pick.CreatorId,pick.TopPick,pick.ParcelId,pick.Name, + pick.Desc,pick.SnapshotId,pick.ParcelName,pick.OriginalName,pick.SimName, + posGlobal,pick.SortOrder,pick.Enabled); + m_log.DebugFormat("[PROFILES]: Finish PickInfoUpdate {0} {1}", pick.Name, pick.PickId.ToString()); } @@ -1008,17 +1019,6 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles /// public void PickDelete(IClientAPI remoteClient, UUID queryPickID) { - // flush cache for now - UserProfileCacheEntry uce = null; - lock(m_profilesCache) - { - if(m_profilesCache.TryGetValue(remoteClient.AgentId, out uce) && uce != null) - { - uce.picks = null; - uce.picksList = null; - } - } - string serverURI = string.Empty; GetUserProfileServerURI(remoteClient.AgentId, out serverURI); if(string.IsNullOrWhiteSpace(serverURI)) @@ -1035,6 +1035,23 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles "Error picks delete", false); return; } + + UserProfileCacheEntry uce = null; + lock(m_profilesCache) + { + if(m_profilesCache.TryGetValue(remoteClient.AgentId, out uce) && uce != null) + { + if(uce.picks != null && uce.picks.ContainsKey(queryPickID)) + uce.picks.Remove(queryPickID); + if(uce.picksList != null && uce.picksList.ContainsKey(queryPickID)) + uce.picksList.Remove(queryPickID); + m_profilesCache.AddOrUpdate(remoteClient.AgentId, uce, PROFILECACHEEXPIRE); + } + } + if(uce != null && uce.picksList != null) + remoteClient.SendAvatarPicksReply(remoteClient.AgentId, uce.picksList); + else + remoteClient.SendAvatarPicksReply(remoteClient.AgentId, new Dictionary()); } #endregion Picks -- cgit v1.1 From 84c3a96399f5233a075100739c270d0202aaaee8 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 22 Dec 2016 07:52:50 +0000 Subject: UserProfileModule refuse changes to classifieds outside home grid ( viewers may show a delete until profile is open again). Charge money only on classified creation sucess --- .../Avatar/UserProfiles/UserProfileModule.cs | 52 ++++++++++++++++------ 1 file changed, 39 insertions(+), 13 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs b/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs index 7a874e2..1ea1306 100644 --- a/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs @@ -570,29 +570,29 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles uint queryParentEstate, UUID querySnapshotID, Vector3 queryGlobalPos, byte queryclassifiedFlags, int queryclassifiedPrice, IClientAPI remoteClient) { - Scene s = (Scene)remoteClient.Scene; Vector3 pos = remoteClient.SceneAgent.AbsolutePosition; ILandObject land = s.LandChannel.GetLandObject(pos.X, pos.Y); UUID creatorId = remoteClient.AgentId; ScenePresence p = FindPresence(creatorId); + UserProfileCacheEntry uce = null; + lock(m_profilesCache) + m_profilesCache.TryGetValue(remoteClient.AgentId, out uce); + string serverURI = string.Empty; - GetUserProfileServerURI(remoteClient.AgentId, out serverURI); + bool foreign = GetUserProfileServerURI(remoteClient.AgentId, out serverURI); if(string.IsNullOrWhiteSpace(serverURI)) { return; } - // just flush cache for now - UserProfileCacheEntry uce = null; - lock(m_profilesCache) + if(foreign) { - if(m_profilesCache.TryGetValue(remoteClient.AgentId, out uce) && uce != null) - { - uce.classifieds = null; - uce.classifiedsLists = null; - } + remoteClient.SendAgentAlertMessage("Please change classifieds on your home grid", true); + if(uce != null && uce.classifiedsLists != null) + remoteClient.SendAvatarClassifiedReply(remoteClient.AgentId, uce.classifiedsLists); + return; } OSDMap parameters = new OSDMap {{"creatorId", OSD.FromUUID(creatorId)}}; @@ -607,17 +607,20 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles bool exists = list.Cast().Where(map => map.ContainsKey("classifieduuid")) .Any(map => map["classifieduuid"].AsUUID().Equals(queryclassifiedID)); + IMoneyModule money = null; if (!exists) { - IMoneyModule money = s.RequestModuleInterface(); + money = s.RequestModuleInterface(); if (money != null) { if (!money.AmountCovered(remoteClient.AgentId, queryclassifiedPrice)) { remoteClient.SendAgentAlertMessage("You do not have enough money to create this classified.", false); + if(uce != null && uce.classifiedsLists != null) + remoteClient.SendAvatarClassifiedReply(remoteClient.AgentId, uce.classifiedsLists); return; } - money.ApplyCharge(remoteClient.AgentId, queryclassifiedPrice, MoneyTransactionType.ClassifiedCharge); +// money.ApplyCharge(remoteClient.AgentId, queryclassifiedPrice, MoneyTransactionType.ClassifiedCharge); } } @@ -644,7 +647,25 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles if(!rpc.JsonRpcRequest(ref Ad, "classified_update", serverURI, UUID.Random().ToString())) { remoteClient.SendAgentAlertMessage("Error updating classified", false); + if(uce != null && uce.classifiedsLists != null) + remoteClient.SendAvatarClassifiedReply(remoteClient.AgentId, uce.classifiedsLists); + return; } + + // only charge if it worked + if (money != null) + money.ApplyCharge(remoteClient.AgentId, queryclassifiedPrice, MoneyTransactionType.ClassifiedCharge); + + // just flush cache for now + lock(m_profilesCache) + { + if(uce != null) + { + uce.classifieds = null; + uce.classifiedsLists = null; + } + } + } /// @@ -670,10 +691,15 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles } string serverURI = string.Empty; - GetUserProfileServerURI(remoteClient.AgentId, out serverURI); + bool foreign = GetUserProfileServerURI(remoteClient.AgentId, out serverURI); if(string.IsNullOrWhiteSpace(serverURI)) return; + if(foreign) + { + remoteClient.SendAgentAlertMessage("Please change classifieds on your home grid", true); + return; + } UUID classifiedId; if(!UUID.TryParse(queryClassifiedID.ToString(), out classifiedId)) return; -- cgit v1.1 From 5b403c448e5975a786d0edffe071a65c8a221adb Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Thu, 22 Dec 2016 15:37:48 +0000 Subject: Update the ini examples to add options missing from one to the other. Group hypergrid related options within each section to ease transition from non-HG to HG --- bin/Robust.HG.ini.example | 60 ++++++++++++++++++++++++++++++++++++++++------- bin/Robust.ini.example | 42 ++++++++++++++------------------- 2 files changed, 68 insertions(+), 34 deletions(-) diff --git a/bin/Robust.HG.ini.example b/bin/Robust.HG.ini.example index c231a8a..b4e426a 100644 --- a/bin/Robust.HG.ini.example +++ b/bin/Robust.HG.ini.example @@ -94,7 +94,13 @@ ;; Uncomment this if you want Groups V2 to work ; GroupsServiceConnector = "${Const|PrivatePort}/OpenSim.Addons.Groups.dll:GroupsServiceRobustConnector" ;; Uncomment to provide bakes caching - ;BakedTextureService = "${Const|PrivatePort}/OpenSim.Server.Handlers.dll:XBakesConnector" + ; BakedTextureService = "${Const|PrivatePort}/OpenSim.Server.Handlers.dll:XBakesConnector" + + ;; Uncomment for UserProfiles see [UserProfilesService] to configure... + ; UserProfilesServiceConnector = "${Const|PublicPort}/OpenSim.Server.Handlers.dll:UserProfilesConnector" + + ;; Uncomment if you want to have centralized estate data + ; EstateDataService = "${Const|PrivatePort}/OpenSim.Server.Handlers.dll:EstateDataRobustConnector" ;; Additions for Hypergrid @@ -108,12 +114,6 @@ ;; Uncomment this if you want Groups V2, HG to work ; HGGroupsServiceConnector = "${Const|PublicPort}/OpenSim.Addons.Groups.dll:HGGroupsServiceRobustConnector" - ;; Uncomment for UserProfiles see [UserProfilesService] to configure... - ; UserProfilesServiceConnector = "${Const|PublicPort}/OpenSim.Server.Handlers.dll:UserProfilesConnector" - - ;; Uncomment if you want to have centralized estate data - ; EstateDataService = "${Const|PrivatePort}/OpenSim.Server.Handlers.dll:EstateDataRobustConnector" - ; * This is common for all services, it's the network setup for the entire ; * server instance, if none is specified above ; * @@ -256,6 +256,18 @@ DefaultAssetLoader = "OpenSim.Framework.AssetLoader.Filesystem.dll" AssetLoaderArgs = "./assets/AssetSets.xml" + ; Allow maptile assets to remotely deleted by remote calls to the asset service. + ; There is no harm in having this as false - it just means that historical maptile assets are not deleted. + ; This only applies to maptiles served via the version 1 viewer mechanisms + ; Default is false + AllowRemoteDelete = false + + ; Allow all assets to be remotely deleted. + ; Only set this to true if you are operating a grid where you control all calls to the asset service + ; (where a necessary condition is that you control all simulators) and you need this for admin purposes. + ; If set to true, AllowRemoteDelete = true is required as well. + ; Default is false. + AllowRemoteDeleteAllTypes = false ; * This configuration loads the inventory server modules. It duplicates ; * the function of the legacy inventory server @@ -307,6 +319,7 @@ ;; ;; Persistent When the simulator is shutdown, the region is signalled as offline but left registered on the grid. ;; + ;; Example specification: ; Region_Welcome_Area = "DefaultRegion, FallbackRegion" ; (replace spaces with underscore) @@ -431,6 +444,9 @@ ; for the server connector LocalServiceModule = "OpenSim.Services.PresenceService.dll:PresenceService" + ; Set this to true to allow the use of advanced web services and multiple + ; bots using one account + AllowDuplicatePresences = false; [AvatarService] ; for the server connector @@ -462,14 +478,21 @@ GridService = "OpenSim.Services.GridService.dll:GridService" SimulationService ="OpenSim.Services.Connectors.dll:SimulationServiceConnector" LibraryService = "OpenSim.Services.InventoryService.dll:LibraryService" - UserAgentService = "OpenSim.Services.HypergridService.dll:UserAgentService" FriendsService = "OpenSim.Services.FriendsService.dll:FriendsService" + ; The minimum user level required for a user to be able to login. 0 by default + ; If you disable a particular user's account then you can set their login level below this number. + ; You can also change this level from the console though these changes will not be persisted. + ; MinLoginLevel = 0 + + ;; for hypergrid + UserAgentService = "OpenSim.Services.HypergridService.dll:UserAgentService" ; This inventory service will be used to initialize the user's inventory HGInventoryServicePlugin = "OpenSim.Services.HypergridService.dll:HGSuitcaseInventoryService" HGInventoryServiceConstructorArg = "HGInventoryService" + ;; end hypergrid - ;; Ask co-operative viewers to use a different currency name + ; Ask co-operative viewers to use a different currency name ;Currency = "" ;; Set minimum fee to publish classified @@ -517,6 +540,24 @@ ;; 'America/Los_Angeles' is used on Linux/Mac systems whilst 'Pacific Standard Time' is used on Windows DSTZone = "America/Los_Angeles;Pacific Standard Time" + ;Basic Login Service Dos Protection Tweaks + ;; + ;; Some Grids/Users use a transparent proxy that makes use of the X-Forwarded-For HTTP Header, If you do, set this to true + ;; If you set this to true and you don't have a transparent proxy, it may allow attackers to put random things in the X-Forwarded-For header to + ;; get around this basic DOS protection. + ;DOSAllowXForwardedForHeader = false + ;; + ;; The protector adds up requests during this rolling period of time, default 10 seconds + ;DOSRequestTimeFrameMS = 10000 + ;; + ;; The amount of requests in the above timeframe from the same endpoint that triggers protection + ;DOSMaxRequestsInTimeFrame = 5 + ;; + ;; The amount of time that a specific endpoint is blocked. Default 2 minutes. + ;DOSForgiveClientAfterMS = 120000 + ;; + ;; To turn off basic dos protection, set the DOSMaxRequestsInTimeFrame to 0. + [MapImageService] LocalServiceModule = "OpenSim.Services.MapImageService.dll:MapImageService" @@ -749,6 +790,7 @@ ;; What is the HomeURI of users associated with this grid? ;; Can overwrite the default in [Hypergrid], but probably shouldn't ; HomeURI = "${Const|BaseURL}:${Const|PublicPort}" + ;; end hypergrid ;; Sets the maximum number of groups an agent may join ; MaxAgentGroups = 42 diff --git a/bin/Robust.ini.example b/bin/Robust.ini.example index 743b23d..7c9f6da 100644 --- a/bin/Robust.ini.example +++ b/bin/Robust.ini.example @@ -81,11 +81,11 @@ MapAddServiceConnector = "${Const|PrivatePort}/OpenSim.Server.Handlers.dll:MapAddServiceConnector" MapGetServiceConnector = "${Const|PublicPort}/OpenSim.Server.Handlers.dll:MapGetServiceConnector" ;; Uncomment this if you want offline IM to work - ;OfflineIMServiceConnector = "${Const|PrivatePort}/OpenSim.Addons.OfflineIM.dll:OfflineIMServiceRobustConnector" + ; OfflineIMServiceConnector = "${Const|PrivatePort}/OpenSim.Addons.OfflineIM.dll:OfflineIMServiceRobustConnector" ;; Uncomment this if you want Groups V2 to work - ;GroupsServiceConnector = "${Const|PrivatePort}/OpenSim.Addons.Groups.dll:GroupsServiceRobustConnector" + ; GroupsServiceConnector = "${Const|PrivatePort}/OpenSim.Addons.Groups.dll:GroupsServiceRobustConnector" ;; Uncomment to provide bakes caching - ;BakedTextureService = "${Const|PrivatePort}/OpenSim.Server.Handlers.dll:XBakesConnector" + ; BakedTextureService = "${Const|PrivatePort}/OpenSim.Server.Handlers.dll:XBakesConnector" ;; Uncomment for UserProfiles see [UserProfilesService] to configure... ; UserProfilesServiceConnector = "${Const|PublicPort}/OpenSim.Server.Handlers.dll:UserProfilesConnector" @@ -214,7 +214,7 @@ ;; The following are common to both the default asset service and FSAsset service - ;; Default loader for loading default assets from XML on first run + ;; Common asset service options DefaultAssetLoader = "OpenSim.Framework.AssetLoader.Filesystem.dll" AssetLoaderArgs = "./assets/AssetSets.xml" @@ -324,6 +324,7 @@ [AuthenticationService] ; for the server connector LocalServiceModule = "OpenSim.Services.AuthenticationService.dll:PasswordAuthenticationService" + ; Realm = "useraccounts" ;; Allow the service to process HTTP getauthinfo calls. ;; Default is false. @@ -344,8 +345,8 @@ UserAccountServiceModule = "OpenSim.Services.UserAccountService.dll:UserAccountService" -; * This is the new style authentication service. Currently, only MySQL -; * is implemented. "Realm" is the table that is used for user lookup. +; * This is the new style user service. +; * "Realm" is the table that is used for user lookup. ; * It defaults to "useraccounts", which uses the new style. ; * Realm = "users" will use the legacy tables as an authentication source ; * @@ -456,15 +457,6 @@ ; HasProxy = false ;# {DSTZone} {} {Override Daylight Saving Time rules} {* none local} "America/Los_Angeles;Pacific Standard Time" - ;; Viewers do not listen to timezone sent by the server. They use Pacific Standard Time instead, - ;; but rely on the server to calculate Daylight Saving Time. Sending another DST than US Pacific - ;; would result in time inconsistencies between grids (during summer and around DST transition period) - ;; default let OpenSim calculate US Pacific DST - ;; "none" disable DST (equivallent to "local" with system set to GMT) - ;; "local" force legacy behaviour (using local system time to calculate DST) - ; DSTZone = "America/Los_Angeles;Pacific Standard Time" - - ;# {DSTZone} {} {Override Daylight Saving Time rules} {* none local} "America/Los_Angeles;Pacific Standard Time" ;; Viewers do not receive timezone information from the server - almost all (?) default to Pacific Standard Time ;; However, they do rely on the server to tell them whether it's Daylight Saving Time or not. ;; Hence, calculating DST based on a different timezone can result in a misleading viewer display and inconsistencies between grids. @@ -509,16 +501,6 @@ ; HasProxy = false -[Messaging] - ; OfflineIM - OfflineIMService = "OpenSim.Addons.OfflineIM.dll:OfflineIMService" - - -[Groups] - ;; Sets the maximum number of groups an agent may join - ; MaxAgentGroups = 42 - - [GridInfoService] ; These settings are used to return information on a get_grid_info call. ; Client launcher scripts and third-party clients make use of this to @@ -559,6 +541,16 @@ ;password = ${Const|BaseURL}/password +[Messaging] + ; OfflineIM + OfflineIMService = "OpenSim.Addons.OfflineIM.dll:OfflineIMService" + + +[Groups] + ;; Sets the maximum number of groups an agent may join + ; MaxAgentGroups = 42 + + [UserProfilesService] LocalServiceModule = "OpenSim.Services.UserProfilesService.dll:UserProfilesService" Enabled = false -- cgit v1.1 From 0ae2b5ac8134230fd5f1bcd668647afb5b345baf Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Thu, 22 Dec 2016 18:23:04 +0000 Subject: Allow the use of modular configs with Robust as we already can with OpenSim --- OpenSim/Server/Base/ServicesServerBase.cs | 148 +++++++++++++++++++++++++----- bin/Robust.HG.ini.example | 2 +- bin/Robust.ini.example | 2 +- 3 files changed, 125 insertions(+), 27 deletions(-) diff --git a/OpenSim/Server/Base/ServicesServerBase.cs b/OpenSim/Server/Base/ServicesServerBase.cs index a7cffd7..e18594f 100644 --- a/OpenSim/Server/Base/ServicesServerBase.cs +++ b/OpenSim/Server/Base/ServicesServerBase.cs @@ -55,11 +55,7 @@ namespace OpenSim.Server.Base // protected string[] m_Arguments; - public string ConfigDirectory - { - get; - private set; - } + protected string m_configDirectory = "."; // Run flag // @@ -101,31 +97,24 @@ namespace OpenSim.Server.Base logConfig =startupConfig.GetString("logconfig", logConfig); } - // Find out of the file name is a URI and remote load it if possible. - // Load it as a local file otherwise. - Uri configUri; + Config = ReadConfigSource(iniFile); - try + List sources = new List(); + sources.Add(iniFile); + + int sourceIndex = 1; + + while (AddIncludes(Config, sources)) { - if (Uri.TryCreate(iniFile, UriKind.Absolute, out configUri) && - configUri.Scheme == Uri.UriSchemeHttp) + for ( ; sourceIndex < sources.Count ; ++sourceIndex) { - XmlReader r = XmlReader.Create(iniFile); - Config = new XmlConfigSource(r); - } - else - { - Config = new IniConfigSource(iniFile); + IConfigSource s = ReadConfigSource(sources[sourceIndex]); + Config.Merge(s); } } - catch (Exception e) - { - System.Console.WriteLine("Error reading from config source. {0}", e.Message); - Environment.Exit(1); - } // Merge OpSys env vars - m_log.Info("[CONFIG]: Loading environment variables for Config"); + Console.WriteLine("[CONFIG]: Loading environment variables for Config"); Util.MergeEnvironmentToConfig(Config); // Merge the configuration from the command line into the loaded file @@ -141,7 +130,7 @@ namespace OpenSim.Server.Base if (startupConfig != null) { - ConfigDirectory = startupConfig.GetString("ConfigDirectory", "."); + m_configDirectory = startupConfig.GetString("ConfigDirectory", m_configDirectory); prompt = startupConfig.GetString("Prompt", prompt); } @@ -241,5 +230,114 @@ namespace OpenSim.Server.Base protected virtual void Initialise() { } + + /// + /// Adds the included files as ini configuration files + /// + /// List of URL strings or filename strings + private bool AddIncludes(IConfigSource configSource, List sources) + { + bool sourcesAdded = false; + + //loop over config sources + foreach (IConfig config in configSource.Configs) + { + // Look for Include-* in the key name + string[] keys = config.GetKeys(); + foreach (string k in keys) + { + if (k.StartsWith("Include-")) + { + // read the config file to be included. + string file = config.GetString(k); + if (IsUri(file)) + { + if (!sources.Contains(file)) + { + sourcesAdded = true; + sources.Add(file); + } + } + else + { + string basepath = Path.GetFullPath(m_configDirectory); + // Resolve relative paths with wildcards + string chunkWithoutWildcards = file; + string chunkWithWildcards = string.Empty; + int wildcardIndex = file.IndexOfAny(new char[] { '*', '?' }); + if (wildcardIndex != -1) + { + chunkWithoutWildcards = file.Substring(0, wildcardIndex); + chunkWithWildcards = file.Substring(wildcardIndex); + } + string path = Path.Combine(basepath, chunkWithoutWildcards); + path = Path.GetFullPath(path) + chunkWithWildcards; + string[] paths = Util.Glob(path); + + // If the include path contains no wildcards, then warn the user that it wasn't found. + if (wildcardIndex == -1 && paths.Length == 0) + { + Console.WriteLine("[CONFIG]: Could not find include file {0}", path); + } + else + { + foreach (string p in paths) + { + if (!sources.Contains(p)) + { + sourcesAdded = true; + sources.Add(p); + } + } + } + } + } + } + } + + return sourcesAdded; + } + + /// + /// Check if we can convert the string to a URI + /// + /// String uri to the remote resource + /// true if we can convert the string to a Uri object + bool IsUri(string file) + { + Uri configUri; + + return Uri.TryCreate(file, UriKind.Absolute, + out configUri) && configUri.Scheme == Uri.UriSchemeHttp; + } + + IConfigSource ReadConfigSource(string iniFile) + { + // Find out of the file name is a URI and remote load it if possible. + // Load it as a local file otherwise. + Uri configUri; + IConfigSource s = null; + + try + { + if (Uri.TryCreate(iniFile, UriKind.Absolute, out configUri) && + configUri.Scheme == Uri.UriSchemeHttp) + { + XmlReader r = XmlReader.Create(iniFile); + s = new XmlConfigSource(r); + } + else + { + s = new IniConfigSource(iniFile); + } + } + catch (Exception e) + { + System.Console.WriteLine("Error reading from config source. {0}", e.Message); + Environment.Exit(1); + } + + return s; + } } -} \ No newline at end of file +} diff --git a/bin/Robust.HG.ini.example b/bin/Robust.HG.ini.example index b4e426a..20c0804 100644 --- a/bin/Robust.HG.ini.example +++ b/bin/Robust.HG.ini.example @@ -58,7 +58,7 @@ ; Modular configurations ; Set path to directory for modular ini files... ; The Robust.exe process must have R/W access to the location - ConfigDirectory = "." + ConfigDirectory = "robust-include" ; Console commands can be saved to a file, so the command history persists after a restart. (default is true) ConsoleHistoryFileEnabled = true diff --git a/bin/Robust.ini.example b/bin/Robust.ini.example index 7c9f6da..d33178c 100644 --- a/bin/Robust.ini.example +++ b/bin/Robust.ini.example @@ -50,7 +50,7 @@ ; Modular configurations ; Set path to directory for modular ini files... ; The Robust.exe process must have R/W access to the location - ConfigDirectory = "." + ConfigDirectory = "robust-include" ; Console commands can be saved to a file, so the command history persists after a restart. (default is true) ConsoleHistoryFileEnabled = true -- cgit v1.1 From 2e7e4427d06951e950019b4175f6dba9358c4d0d Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 23 Dec 2016 02:17:42 +0000 Subject: UserProfileModule threading issues --- .../Avatar/UserProfiles/UserProfileModule.cs | 140 +++++++++++---------- 1 file changed, 77 insertions(+), 63 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs b/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs index 1ea1306..d232d82 100644 --- a/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs @@ -438,12 +438,14 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles } } - if(uce == null) - uce = new UserProfileCacheEntry(); - uce.classifiedsLists = classifieds; + lock(m_profilesCache) + { + if(!m_profilesCache.TryGetValue(targetID, out uce) || uce == null) + uce = new UserProfileCacheEntry(); + uce.classifiedsLists = classifieds; - lock(m_profilesCache) m_profilesCache.AddOrUpdate(targetID, uce, PROFILECACHEEXPIRE); + } remoteClient.SendAvatarClassifiedReply(targetID, classifieds); } @@ -512,14 +514,16 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles if(foreign) cacheForeignImage(target, ad.SnapshotId); - if(uce == null) - uce = new UserProfileCacheEntry(); - if(uce.classifieds == null) - uce.classifieds = new Dictionary(); - uce.classifieds[ad.ClassifiedId] = ad; - lock(m_profilesCache) - m_profilesCache.AddOrUpdate(ad.ClassifiedId, uce, PROFILECACHEEXPIRE); + { + if(!m_profilesCache.TryGetValue(target, out uce) || uce == null) + uce = new UserProfileCacheEntry(); + if(uce.classifieds == null) + uce.classifieds = new Dictionary(); + uce.classifieds[ad.ClassifiedId] = ad; + + m_profilesCache.AddOrUpdate(target, uce, PROFILECACHEEXPIRE); + } Vector3 globalPos = new Vector3(); Vector3.TryParse(ad.GlobalPos, out globalPos); @@ -659,7 +663,7 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles // just flush cache for now lock(m_profilesCache) { - if(uce != null) + if(m_profilesCache.TryGetValue(remoteClient.AgentId, out uce) && uce != null) { uce.classifieds = null; uce.classifiedsLists = null; @@ -679,16 +683,6 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles /// public void ClassifiedDelete(UUID queryClassifiedID, IClientAPI remoteClient) { - // just flush cache for now - UserProfileCacheEntry uce = null; - lock(m_profilesCache) - { - if(m_profilesCache.TryGetValue(remoteClient.AgentId, out uce) && uce != null) - { - uce.classifieds = null; - uce.classifiedsLists = null; - } - } string serverURI = string.Empty; bool foreign = GetUserProfileServerURI(remoteClient.AgentId, out serverURI); @@ -700,6 +694,7 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles remoteClient.SendAgentAlertMessage("Please change classifieds on your home grid", true); return; } + UUID classifiedId; if(!UUID.TryParse(queryClassifiedID.ToString(), out classifiedId)) return; @@ -714,6 +709,17 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles return; } + // flush cache + UserProfileCacheEntry uce = null; + lock(m_profilesCache) + { + if(m_profilesCache.TryGetValue(remoteClient.AgentId, out uce) && uce != null) + { + uce.classifieds = null; + uce.classifiedsLists = null; + } + } + parameters = (OSDMap)Params; } #endregion Classified @@ -797,12 +803,14 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles picks[cid] = name; } - if (uce == null) - uce = new UserProfileCacheEntry(); - uce.picksList = picks; - lock(m_profilesCache) + { + if(!m_profilesCache.TryGetValue(targetId, out uce) || uce == null) + uce = new UserProfileCacheEntry(); + uce.picksList = picks; + m_profilesCache.AddOrUpdate(targetId, uce, PROFILECACHEEXPIRE); + } remoteClient.SendAvatarPicksReply(targetId, picks); } @@ -903,14 +911,16 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles m_log.DebugFormat("[PROFILES]: PickInfoRequest: {0} : {1}", pick.Name.ToString(), pick.SnapshotId.ToString()); pick.GlobalPos = globalPos.ToString(); - if (uce == null) - uce = new UserProfileCacheEntry(); - if(uce.picks == null) - uce.picks = new Dictionary(); - uce.picks[pick.PickId] = pick; - lock(m_profilesCache) + { + if(!m_profilesCache.TryGetValue(targetID, out uce) || uce == null) + uce = new UserProfileCacheEntry(); + if(uce.picks == null) + uce.picks = new Dictionary(); + uce.picks[pick.PickId] = pick; + m_profilesCache.AddOrUpdate(targetID, uce, PROFILECACHEEXPIRE); + } // Pull the rabbit out of the hat remoteClient.SendPickInfoReply(pick.PickId,pick.CreatorId,pick.TopPick,pick.ParcelId,pick.Name, @@ -950,7 +960,6 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles /// public void PickInfoUpdate(IClientAPI remoteClient, UUID pickID, UUID creatorID, bool topPick, string name, string desc, UUID snapshotID, int sortOrder, bool enabled) { - //TODO: See how this works with NPC, May need to test m_log.DebugFormat("[PROFILES]: Start PickInfoUpdate Name: {0} PickId: {1} SnapshotId: {2}", name, pickID.ToString(), snapshotID.ToString()); UserProfilePick pick = new UserProfilePick(); @@ -1067,11 +1076,11 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles { if(m_profilesCache.TryGetValue(remoteClient.AgentId, out uce) && uce != null) { - if(uce.picks != null && uce.picks.ContainsKey(queryPickID)) - uce.picks.Remove(queryPickID); - if(uce.picksList != null && uce.picksList.ContainsKey(queryPickID)) - uce.picksList.Remove(queryPickID); - m_profilesCache.AddOrUpdate(remoteClient.AgentId, uce, PROFILECACHEEXPIRE); + if(uce.picks != null && uce.picks.ContainsKey(queryPickID)) + uce.picks.Remove(queryPickID); + if(uce.picksList != null && uce.picksList.ContainsKey(queryPickID)) + uce.picksList.Remove(queryPickID); + m_profilesCache.AddOrUpdate(remoteClient.AgentId, uce, PROFILECACHEEXPIRE); } } if(uce != null && uce.picksList != null) @@ -1259,15 +1268,6 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles /// public void AvatarInterestsUpdate(IClientAPI remoteClient, uint wantmask, string wanttext, uint skillsmask, string skillstext, string languages) { - // flush cache for now - UserProfileCacheEntry uce = null; - lock(m_profilesCache) - { - if(m_profilesCache.TryGetValue(remoteClient.AgentId, out uce) && uce != null) - { - uce.props = null; - } - } UserProfileProperties prop = new UserProfileProperties(); @@ -1290,6 +1290,17 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles "Error updating interests", false); return; } + + // flush cache + UserProfileCacheEntry uce = null; + lock(m_profilesCache) + { + if(m_profilesCache.TryGetValue(remoteClient.AgentId, out uce) && uce != null) + { + uce.props = null; + } + } + } public void RequestAvatarProperties(IClientAPI remoteClient, UUID avatarID) @@ -1399,15 +1410,17 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles if(!m_allowUserProfileWebURLs) props.WebUrl =""; - if(uce == null) - uce = new UserProfileCacheEntry(); - uce.props = props; - uce.born = born; - uce.membershipType = membershipType; - uce.flags = flags; - lock(m_profilesCache) + { + if(!m_profilesCache.TryGetValue(props.UserId, out uce) || uce == null) + uce = new UserProfileCacheEntry(); + uce.props = props; + uce.born = born; + uce.membershipType = membershipType; + uce.flags = flags; + m_profilesCache.AddOrUpdate(props.UserId, uce, PROFILECACHEEXPIRE); + } remoteClient.SendAvatarProperties(props.UserId, props.AboutText, born, membershipType , props.FirstLifeText, flags, props.FirstLifeImageId, props.ImageId, props.WebUrl, props.PartnerId); @@ -1429,15 +1442,6 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles { if (remoteClient.AgentId == newProfile.ID) { - // flush cache for now - UserProfileCacheEntry uce = null; - lock(m_profilesCache) - { - if(m_profilesCache.TryGetValue(remoteClient.AgentId, out uce) && uce != null) - { - uce.props = null; - } - } UserProfileProperties prop = new UserProfileProperties(); @@ -1463,6 +1467,16 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles return; } + // flush cache + UserProfileCacheEntry uce = null; + lock(m_profilesCache) + { + if(m_profilesCache.TryGetValue(remoteClient.AgentId, out uce) && uce != null) + { + uce.props = null; + } + } + RequestAvatarProperties(remoteClient, newProfile.ID); } } -- cgit v1.1