aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs67
1 files changed, 37 insertions, 30 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs b/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs
index 3d45f1d..1ee2a7b 100644
--- a/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs
@@ -65,6 +65,8 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
65 Dictionary<UUID, UUID> m_classifiedCache = new Dictionary<UUID, UUID>(); 65 Dictionary<UUID, UUID> m_classifiedCache = new Dictionary<UUID, UUID>();
66 Dictionary<UUID, int> m_classifiedInterest = new Dictionary<UUID, int>(); 66 Dictionary<UUID, int> m_classifiedInterest = new Dictionary<UUID, int>();
67 67
68 private JsonRpcRequestManager rpc = new JsonRpcRequestManager();
69
68 public Scene Scene 70 public Scene Scene
69 { 71 {
70 get; private set; 72 get; private set;
@@ -114,7 +116,6 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
114 set; 116 set;
115 } 117 }
116 118
117 JsonRpcRequestManager rpc = new JsonRpcRequestManager();
118 119
119 #region IRegionModuleBase implementation 120 #region IRegionModuleBase implementation
120 /// <summary> 121 /// <summary>
@@ -920,7 +921,7 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
920 921
921 public void RequestAvatarProperties(IClientAPI remoteClient, UUID avatarID) 922 public void RequestAvatarProperties(IClientAPI remoteClient, UUID avatarID)
922 { 923 {
923 if ( String.IsNullOrEmpty(avatarID.ToString()) || String.IsNullOrEmpty(remoteClient.AgentId.ToString())) 924 if (String.IsNullOrEmpty(avatarID.ToString()) || String.IsNullOrEmpty(remoteClient.AgentId.ToString()))
924 { 925 {
925 // Looking for a reason that some viewers are sending null Id's 926 // Looking for a reason that some viewers are sending null Id's
926 m_log.DebugFormat("[PROFILES]: This should not happen remoteClient.AgentId {0} - avatarID {1}", remoteClient.AgentId, avatarID); 927 m_log.DebugFormat("[PROFILES]: This should not happen remoteClient.AgentId {0} - avatarID {1}", remoteClient.AgentId, avatarID);
@@ -998,29 +999,10 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
998 999
999 props.UserId = avatarID; 1000 props.UserId = avatarID;
1000 1001
1001 try 1002 if (!GetProfileData(ref props, foreign, out result))
1002 {
1003 GetProfileData(ref props, out result);
1004 }
1005 catch (Exception e)
1006 { 1003 {
1007 if (foreign) 1004 m_log.DebugFormat("Error getting profile for {0}: {1}", avatarID, result);
1008 { 1005 return;
1009 // Check if the foreign grid is using OpenProfile.
1010 // If any error occurs then discard it, and report the original error.
1011 try
1012 {
1013 OpenProfileClient client = new OpenProfileClient(serverURI);
1014 if (!client.RequestAvatarPropertiesUsingOpenProfile(ref props))
1015 throw e;
1016 }
1017 catch (Exception)
1018 {
1019 throw e;
1020 }
1021 }
1022 else
1023 throw;
1024 } 1006 }
1025 1007
1026 remoteClient.SendAvatarProperties(props.UserId, props.AboutText, born, charterMember , props.FirstLifeText, flags, 1008 remoteClient.SendAvatarProperties(props.UserId, props.AboutText, born, charterMember , props.FirstLifeText, flags,
@@ -1074,10 +1056,7 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
1074 /// <returns> 1056 /// <returns>
1075 /// The profile data. 1057 /// The profile data.
1076 /// </returns> 1058 /// </returns>
1077 /// <param name='userID'> 1059 bool GetProfileData(ref UserProfileProperties properties, bool foreign, out string message)
1078 /// User I.
1079 /// </param>
1080 bool GetProfileData(ref UserProfileProperties properties, out string message)
1081 { 1060 {
1082 // Can't handle NPC yet... 1061 // Can't handle NPC yet...
1083 ScenePresence p = FindPresence(properties.UserId); 1062 ScenePresence p = FindPresence(properties.UserId);
@@ -1096,14 +1075,42 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
1096 1075
1097 // This is checking a friend on the home grid 1076 // This is checking a friend on the home grid
1098 // Not HG friend 1077 // Not HG friend
1099 if ( String.IsNullOrEmpty(serverURI)) 1078 if (String.IsNullOrEmpty(serverURI))
1100 { 1079 {
1101 message = "No Presence - foreign friend"; 1080 message = "No Presence - foreign friend";
1102 return false; 1081 return false;
1103 } 1082 }
1104 1083
1105 object Prop = (object)properties; 1084 object Prop = (object)properties;
1106 rpc.JsonRpcRequest(ref Prop, "avatar_properties_request", serverURI, UUID.Random().ToString()); 1085 if (!rpc.JsonRpcRequest(ref Prop, "avatar_properties_request", serverURI, UUID.Random().ToString()))
1086 {
1087 // If it's a foreign user then try again using OpenProfile, in case that's what the grid is using
1088 bool secondChanceSuccess = false;
1089 if (foreign)
1090 {
1091 try
1092 {
1093 OpenProfileClient client = new OpenProfileClient(serverURI);
1094 if (client.RequestAvatarPropertiesUsingOpenProfile(ref properties))
1095 secondChanceSuccess = true;
1096 }
1097 catch (Exception e)
1098 {
1099 m_log.Debug(string.Format("Request using the OpenProfile API to {0} failed", serverURI), e);
1100 // Allow the return 'message' to say "JsonRpcRequest" and not "OpenProfile", because
1101 // the most likely reason that OpenProfile failed is that the remote server
1102 // doesn't support OpenProfile, and that's not very interesting.
1103 }
1104 }
1105
1106 if (!secondChanceSuccess)
1107 {
1108 message = string.Format("JsonRpcRequest to {0} failed", serverURI);
1109 return false;
1110 }
1111 // else, continue below
1112 }
1113
1107 properties = (UserProfileProperties)Prop; 1114 properties = (UserProfileProperties)Prop;
1108 1115
1109 message = "Success"; 1116 message = "Success";