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 +--
1 file changed, 1 insertion(+), 2 deletions(-)
(limited to 'OpenSim/Region')
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
+}
--
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 -
3 files changed, 1 insertion(+), 5 deletions(-)
(limited to 'OpenSim/Region')
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();
--
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(-)
(limited to 'OpenSim/Region')
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 +++++++++-------------
1 file changed, 14 insertions(+), 22 deletions(-)
(limited to 'OpenSim/Region')
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;
--
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(-)
(limited to 'OpenSim/Region')
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
---
.../Avatar/UserProfiles/UserProfileModule.cs | 387 ++++++++++++++++-----
1 file changed, 296 insertions(+), 91 deletions(-)
(limited to 'OpenSim/Region')
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(-)
(limited to 'OpenSim/Region')
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(-)
(limited to 'OpenSim/Region')
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 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(-)
(limited to 'OpenSim/Region')
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