aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorUbitUmarov2016-12-22 07:06:40 +0000
committerUbitUmarov2016-12-22 07:06:40 +0000
commit5571c499ba1658905c40a1d2d823031591649512 (patch)
tree39de25393e3b51adef05807af03ff51a1b639507
parent take UserProfileModule out on onMakeRoot event, add some caching (diff)
downloadopensim-SC-5571c499ba1658905c40a1d2d823031591649512.zip
opensim-SC-5571c499ba1658905c40a1d2d823031591649512.tar.gz
opensim-SC-5571c499ba1658905c40a1d2d823031591649512.tar.bz2
opensim-SC-5571c499ba1658905c40a1d2d823031591649512.tar.xz
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
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs65
1 files 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
927 //TODO: See how this works with NPC, May need to test 927 //TODO: See how this works with NPC, May need to test
928 m_log.DebugFormat("[PROFILES]: Start PickInfoUpdate Name: {0} PickId: {1} SnapshotId: {2}", name, pickID.ToString(), snapshotID.ToString()); 928 m_log.DebugFormat("[PROFILES]: Start PickInfoUpdate Name: {0} PickId: {1} SnapshotId: {2}", name, pickID.ToString(), snapshotID.ToString());
929 929
930 // flush cache for now
931 UserProfileCacheEntry uce = null;
932 lock(m_profilesCache)
933 {
934 if(m_profilesCache.TryGetValue(remoteClient.AgentId, out uce) && uce != null)
935 {
936 uce.picks = null;
937 uce.picksList = null;
938 }
939 }
940
941 UserProfilePick pick = new UserProfilePick(); 930 UserProfilePick pick = new UserProfilePick();
942 string serverURI = string.Empty; 931 string serverURI = string.Empty;
943 GetUserProfileServerURI(remoteClient.AgentId, out serverURI); 932 GetUserProfileServerURI(remoteClient.AgentId, out serverURI);
@@ -955,15 +944,19 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
955 avaPos.Z); 944 avaPos.Z);
956 945
957 string landParcelName = "My Parcel"; 946 string landParcelName = "My Parcel";
958 UUID landParcelID = p.currentParcelUUID; 947// UUID landParcelID = p.currentParcelUUID;
959 948
949 // to locate parcels we use a fake id that encodes the region handle
950 // since we do not have a global locator
951 // this fails on HG
952 UUID landParcelID = Util.BuildFakeParcelID(remoteClient.Scene.RegionInfo.RegionHandle, (uint)avaPos.X, (uint)avaPos.Y);
960 ILandObject land = p.Scene.LandChannel.GetLandObject(avaPos.X, avaPos.Y); 953 ILandObject land = p.Scene.LandChannel.GetLandObject(avaPos.X, avaPos.Y);
961 954
962 if (land != null) 955 if (land != null)
963 { 956 {
964 // If land found, use parcel uuid from here because the value from SP will be blank if the avatar hasnt moved 957 // If land found, use parcel uuid from here because the value from SP will be blank if the avatar hasnt moved
965 landParcelName = land.LandData.Name; 958 landParcelName = land.LandData.Name;
966 landParcelID = land.LandData.GlobalID; 959// landParcelID = land.LandData.GlobalID;
967 } 960 }
968 else 961 else
969 { 962 {
@@ -994,6 +987,24 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
994 return; 987 return;
995 } 988 }
996 989
990 UserProfileCacheEntry uce = null;
991 lock(m_profilesCache)
992 {
993 if(!m_profilesCache.TryGetValue(remoteClient.AgentId, out uce) || uce == null)
994 uce = new UserProfileCacheEntry();
995 if(uce.picks == null)
996 uce.picks = new Dictionary<UUID, UserProfilePick>();
997 if(uce.picksList == null)
998 uce.picksList = new Dictionary<UUID, string>();
999 uce.picks[pick.PickId] = pick;
1000 uce.picksList[pick.PickId] = pick.Name;
1001 m_profilesCache.AddOrUpdate(remoteClient.AgentId, uce, PROFILECACHEEXPIRE);
1002 }
1003 remoteClient.SendAvatarPicksReply(remoteClient.AgentId, uce.picksList);
1004 remoteClient.SendPickInfoReply(pick.PickId,pick.CreatorId,pick.TopPick,pick.ParcelId,pick.Name,
1005 pick.Desc,pick.SnapshotId,pick.ParcelName,pick.OriginalName,pick.SimName,
1006 posGlobal,pick.SortOrder,pick.Enabled);
1007
997 m_log.DebugFormat("[PROFILES]: Finish PickInfoUpdate {0} {1}", pick.Name, pick.PickId.ToString()); 1008 m_log.DebugFormat("[PROFILES]: Finish PickInfoUpdate {0} {1}", pick.Name, pick.PickId.ToString());
998 } 1009 }
999 1010
@@ -1008,17 +1019,6 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
1008 /// </param> 1019 /// </param>
1009 public void PickDelete(IClientAPI remoteClient, UUID queryPickID) 1020 public void PickDelete(IClientAPI remoteClient, UUID queryPickID)
1010 { 1021 {
1011 // flush cache for now
1012 UserProfileCacheEntry uce = null;
1013 lock(m_profilesCache)
1014 {
1015 if(m_profilesCache.TryGetValue(remoteClient.AgentId, out uce) && uce != null)
1016 {
1017 uce.picks = null;
1018 uce.picksList = null;
1019 }
1020 }
1021
1022 string serverURI = string.Empty; 1022 string serverURI = string.Empty;
1023 GetUserProfileServerURI(remoteClient.AgentId, out serverURI); 1023 GetUserProfileServerURI(remoteClient.AgentId, out serverURI);
1024 if(string.IsNullOrWhiteSpace(serverURI)) 1024 if(string.IsNullOrWhiteSpace(serverURI))
@@ -1035,6 +1035,23 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
1035 "Error picks delete", false); 1035 "Error picks delete", false);
1036 return; 1036 return;
1037 } 1037 }
1038
1039 UserProfileCacheEntry uce = null;
1040 lock(m_profilesCache)
1041 {
1042 if(m_profilesCache.TryGetValue(remoteClient.AgentId, out uce) && uce != null)
1043 {
1044 if(uce.picks != null && uce.picks.ContainsKey(queryPickID))
1045 uce.picks.Remove(queryPickID);
1046 if(uce.picksList != null && uce.picksList.ContainsKey(queryPickID))
1047 uce.picksList.Remove(queryPickID);
1048 m_profilesCache.AddOrUpdate(remoteClient.AgentId, uce, PROFILECACHEEXPIRE);
1049 }
1050 }
1051 if(uce != null && uce.picksList != null)
1052 remoteClient.SendAvatarPicksReply(remoteClient.AgentId, uce.picksList);
1053 else
1054 remoteClient.SendAvatarPicksReply(remoteClient.AgentId, new Dictionary<UUID, string>());
1038 } 1055 }
1039 #endregion Picks 1056 #endregion Picks
1040 1057